INT-2620 Fix Race Condition in Failover Tests
Sporadic test failures (fairly consistently on Mac). Problem was some tests sent a message to a client socket before the close notification had been received. Wait for client connection to close rather than waiting for the server to stop. Also, with NIO, close the channel on accept exception. Also improve debugging by including a log of new connections including the id.
This commit is contained in:
@@ -335,7 +335,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
Message<?> replyMessage = replyChannel.receive(10000);
|
||||
assertNotNull(replyMessage);
|
||||
server1.stop();
|
||||
TestingUtilities.waitStopListening(server1, null);
|
||||
TestingUtilities.waitUntilFactoryHasThisNumberOfConnections(client1, 0);
|
||||
outGateway.handleMessage(message);
|
||||
socket = getSocket(client2);
|
||||
port2 = socket.getLocalPort();
|
||||
@@ -343,6 +343,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
replyMessage = replyChannel.receive(10000);
|
||||
assertNotNull(replyMessage);
|
||||
gateway2.stop();
|
||||
outGateway.stop();
|
||||
}
|
||||
|
||||
private Socket getSocket(AbstractClientConnectionFactory client) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user