Removed test client
This commit is contained in:
parent
bda6330fbb
commit
aac8d626e1
2 changed files with 0 additions and 82 deletions
|
@ -1,54 +0,0 @@
|
|||
package client;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
|
||||
public class ClientRunner implements Runnable {
|
||||
long sleep;
|
||||
private String host;
|
||||
private Integer port;
|
||||
private boolean skip;
|
||||
|
||||
public ClientRunner(String host, Integer port, long sleep, boolean skip) {
|
||||
this.sleep = sleep;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.skip = skip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Socket socket = new Socket(host, port);
|
||||
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);
|
||||
|
||||
out.println("WRK");
|
||||
String work = in.readLine();
|
||||
System.out.println("Sleep: "+sleep+", skip: "+skip+", work: "+work);
|
||||
|
||||
socket.close();
|
||||
if (!skip) {
|
||||
Thread.sleep(sleep);
|
||||
|
||||
socket = new Socket(host, port);
|
||||
|
||||
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);
|
||||
|
||||
out.println("RES");
|
||||
out.println(work);
|
||||
|
||||
socket.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package client;
|
||||
|
||||
public class CommClient {
|
||||
private static final String HOST = "localhost";
|
||||
private static final Integer PORT = 26765;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
new Thread(new ClientRunner(HOST, PORT, 5000, false)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 15000, false)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 0, true)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 5000, false)).start();
|
||||
}
|
||||
|
||||
Thread.sleep(20000);
|
||||
System.out.println("******** BATCH 2 ********");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
new Thread(new ClientRunner(HOST, PORT, 5000, false)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 5000, false)).start();
|
||||
|
||||
new Thread(new ClientRunner(HOST, PORT, 15000, false)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 0, true)).start();
|
||||
new Thread(new ClientRunner(HOST, PORT, 5000, false)).start();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue