INT-2839 Fix Test Race Condition

A secondary part of the new gateway test was to ensure we
reused the cached connection. However, there was a race condition
in that the connection may not yet have been returned to the pool
by the reader thread that received the response.
This commit is contained in:
Gary Russell
2012-11-29 21:28:27 -05:00
parent 3d04e15fd3
commit 734eae72a7

View File

@@ -320,6 +320,9 @@ public class CachingClientConnectionFactoryTests {
assertNotNull(m);
assertEquals("foo:" + "Hello, world!", new String((byte[]) m.getPayload()));
// wait a short time to allow the connection to be returned to the pool
Thread.sleep(1000);
// assert we use the same connection from the pool
toGateway.send(new GenericMessage<String>("Hello, world2!"));
m = fromGateway.receive(1000);