Fix FailoverClientConnectionFactoryTests

Race condition in `ServerSocket`; the `accept` thread is exiting due to the
close, but it still accepted a new message.

All tests need to wait until the server has stopped listening (as well as
waiting for the close to be propagated to the client).
This commit is contained in:
Gary Russell
2015-08-11 10:49:26 -04:00
parent e408331e67
commit a70bc06a18
2 changed files with 4 additions and 1 deletions

View File

@@ -570,6 +570,7 @@ public class FailoverClientConnectionFactoryTests {
Message<?> replyMessage = replyChannel.receive(10000);
assertNotNull(replyMessage);
server1.stop();
TestingUtilities.waitStopListening(server1, 10000L);
TestingUtilities.waitUntilFactoryHasThisNumberOfConnections(client1, 0);
outGateway.handleMessage(message);
if (!singleUse) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.ip.util.TestingUtilities;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -42,6 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@DirtiesContext
public class SOLingerTests {
@Autowired