Fix Read Modified Query from Moshix bug report
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 50s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 1m24s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m38s
Release j3270 / Build & Publish Release (push) Successful in 1m38s
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 50s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 1m24s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m38s
Release j3270 / Build & Publish Release (push) Successful in 1m38s
This commit is contained in:
@@ -67,7 +67,9 @@ public class Mock3270Server implements AutoCloseable {
|
||||
}
|
||||
|
||||
public Mock3270Server(int requestedPort) throws IOException {
|
||||
this.serverSocket = new ServerSocket(requestedPort, 10, InetAddress.getByName("127.0.0.1"));
|
||||
this.serverSocket = new ServerSocket();
|
||||
this.serverSocket.setReuseAddress(true);
|
||||
this.serverSocket.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), requestedPort), 10);
|
||||
this.port = serverSocket.getLocalPort();
|
||||
this.translator = new EbcdicTranslator();
|
||||
executor.submit(this::acceptLoop);
|
||||
@@ -571,6 +573,11 @@ public class Mock3270Server implements AutoCloseable {
|
||||
} catch (Exception ignored) {}
|
||||
disconnectClient();
|
||||
executor.shutdownNow();
|
||||
try {
|
||||
executor.awaitTermination(200, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
log.info("Mock3270Server stopped");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -76,8 +76,8 @@ public class Mock3270ServerIntegrationTest {
|
||||
public void testSendScreenAndVerifyPresentationSpace() 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));
|
||||
assertTrue(client.connect(8000), "Client should connect to mock server");
|
||||
assertTrue(server.waitForHandshake(5, TimeUnit.SECONDS), "Server handshake should complete within 5s");
|
||||
waitForState(client, ConnectionState.CONNECTED_TN3270E, 5000);
|
||||
|
||||
// Server sends formatted greeting screen at row 2, col 10
|
||||
@@ -243,7 +243,10 @@ public class Mock3270ServerIntegrationTest {
|
||||
// Disconnect active client connection abruptly
|
||||
server.disconnectClient();
|
||||
|
||||
// Wait for client to detect disconnect and reconnect automatically
|
||||
// Wait for client to detect disconnect and enter RECONNECTING
|
||||
waitForState(client, ConnectionState.RECONNECTING, 5000);
|
||||
|
||||
// Wait for client to reconnect automatically
|
||||
waitForState(client, ConnectionState.CONNECTED_TN3270E, 8000);
|
||||
assertEquals(ConnectionState.CONNECTED_TN3270E, client.getConnectionState());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user