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
public void run() {
writeLine(readLine());
while (socket.isConnected()) {
writeLine(readLine());
}
}
}

View File

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