Skip to content

Commit dfd80f1

Browse files
committed
workout for failing unit test
1 parent 3bca0bc commit dfd80f1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.apache.mina.transport.socket.SocketSessionConfig;
4444
import org.apache.mina.util.AvailablePortFinder;
4545
import org.junit.After;
46+
import org.junit.Assert;
4647
import org.junit.Ignore;
4748
import org.junit.Test;
4849
import org.slf4j.Logger;
@@ -156,13 +157,18 @@ public void testDuplicateUnbind() throws IOException {
156157
}
157158

158159
@Test
159-
public void testManyTimes() throws IOException {
160+
public void testManyTimes() throws IOException, InterruptedException {
160161
bind(true);
161162

162-
for (int i = 0; i < 1024; i++) {
163-
acceptor.unbind();
164-
acceptor.bind();
165-
}
163+
for (int i = 0; i < 1024; i++) {
164+
Assert.assertTrue("Bound addresses is empty", acceptor.getLocalAddresses().size() > 0);
165+
acceptor.unbind();
166+
Thread.sleep(1);
167+
Assert.assertTrue("Bound addresses is not empty", acceptor.getLocalAddresses().size() == 0);
168+
acceptor.bind();
169+
}
170+
171+
acceptor.unbind();
166172
}
167173

168174
@Test

0 commit comments

Comments
 (0)