You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jo...@apache.org on 2021/10/04 17:44:01 UTC

[mina] branch 2.2.X updated: workaround for failing unit test

This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a commit to branch 2.2.X
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/2.2.X by this push:
     new 37fc70e  workaround for failing unit test
37fc70e is described below

commit 37fc70eb99789deeacb2a4b2bd4fff89cc42b13e
Author: Jonathan Valliere <jo...@apache.org>
AuthorDate: Mon Oct 4 13:42:55 2021 -0400

    workaround for failing unit test
---
 .../java/org/apache/mina/transport/AbstractBindTest.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java b/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
index 938c134..e43e94c 100644
--- a/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
+++ b/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
@@ -43,6 +43,7 @@ import org.apache.mina.transport.socket.SocketAcceptor;
 import org.apache.mina.transport.socket.SocketSessionConfig;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -156,13 +157,18 @@ public abstract class AbstractBindTest {
     }
 
     @Test
-    public void testManyTimes() throws IOException {
+    public void testManyTimes() throws IOException, InterruptedException {
         bind(true);
 
-        for (int i = 0; i < 1024; i++) {
-            acceptor.unbind();
-            acceptor.bind();
-        }
+		for (int i = 0; i < 1024; i++) {
+			Assert.assertTrue("Bound addresses is empty", acceptor.getLocalAddresses().size() > 0);
+			acceptor.unbind();
+			Thread.sleep(1);
+			Assert.assertTrue("Bound addresses is not empty", acceptor.getLocalAddresses().size() == 0);
+			acceptor.bind();
+		}
+
+        acceptor.unbind();
     }
 
     @Test