Fix disconnect notifiers
This commit is contained in:
+20
@@ -335,4 +335,24 @@ public class Mock3270ServerIntegrationTest {
|
||||
}
|
||||
assertTrue(receivedWontOrDontTn3270e, "Server should have received Telnet de-negotiation for TN3270E");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServerSideDisconnectTransitionsClientToNotConnectedAndClosesSocket() throws Exception {
|
||||
ConnectionConfig config = new ConnectionConfig("127.0.0.1", server.getPort(), TerminalModel.IBM_3279_2);
|
||||
client = new Telnet3270Client(config);
|
||||
assertTrue(client.connect(8000));
|
||||
assertTrue(server.waitForHandshake(5, TimeUnit.SECONDS));
|
||||
waitForState(client, ConnectionState.CONNECTED_TN3270E, 5000);
|
||||
assertTrue(client.isConnected());
|
||||
|
||||
// Server drops connection (host disconnect)
|
||||
server.disconnectClient();
|
||||
|
||||
// Wait for client to detect disconnect
|
||||
waitForState(client, ConnectionState.NOT_CONNECTED, 5000);
|
||||
assertEquals(ConnectionState.NOT_CONNECTED, client.getConnectionState());
|
||||
assertFalse(client.isConnected(), "Client must report isConnected() == false after host disconnect");
|
||||
assertNotNull(client.getConnection());
|
||||
assertFalse(client.getConnection().isConnected(), "TelnetConnection must report isConnected() == false after host disconnect");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user