From b271a7c42c1a08ec4146ab668ecffc721fe90ee3 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 8 May 2012 14:33:14 -0400 Subject: [PATCH] INT-2519 Fix Failing Test Depending on timing, it was possible the event the test case was waiting for would never happen. With no timeout the selector will block until the next IO event occurs, and there is none in this test. Adding a call to factory.close() forces a wakeup of the selector, which will force the harvest to occur. This is a test-only problem. --- .../integration/ip/tcp/connection/TcpNioConnectionTests.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java index 0b6b412cd2..8b60b3e8ae 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java @@ -155,6 +155,8 @@ public class TcpNioConnectionTests { assertEquals(1, connections.size()); connection.close(); assertTrue(!connection.isOpen()); + // force a wakeup of the selector + factory.close(); int n = 0; while (connections.size() > 0) { Thread.sleep(100);