repeatable test echo client

This commit is contained in:
bvn13 2022-01-28 15:22:57 +03:00
parent c93b36cc7f
commit f917dc6722
2 changed files with 8 additions and 3 deletions

View File

@ -9,6 +9,8 @@ public class EchoClientListener extends AbstractClientListener {
@Override @Override
public void run() { public void run() {
while (socket.isConnected()) {
writeLine(readLine()); writeLine(readLine());
} }
} }
}

View File

@ -57,8 +57,11 @@ public class ServerTest {
new Server("localhost", port, EchoClientListener.class); new Server("localhost", port, EchoClientListener.class);
Client client = new Client("localhost", port); Client client = new Client("localhost", port);
client.writeLine("hello"); client.writeLine("hello");
String response = client.readLine(); String response1 = client.readLine();
Assertions.assertEquals("hello", response); Assertions.assertEquals("hello", response1);
client.writeLine("olleh");
String response2 = client.readLine();
Assertions.assertEquals("olleh", response2);
} }
} }