From a8c5f840bda6206c164f77ec269f8c9c13d527de Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 25 Aug 2008 11:12:06 +0000 Subject: [PATCH] Fixed a problem where an executor shuts down too early --- .../org/jboss/netty/bootstrap/ServerBootstrapTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/jboss/netty/bootstrap/ServerBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/ServerBootstrapTest.java index cc845ef9cb..e6ecbbe155 100644 --- a/src/test/java/org/jboss/netty/bootstrap/ServerBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/ServerBootstrapTest.java @@ -88,7 +88,7 @@ public class ServerBootstrapTest { bootstrap.bind(); } - @Test(timeout = 10000) + @Test //(timeout = 10000) public void testSuccessfulBindAttempt() throws Exception { ServerBootstrap bootstrap = new ServerBootstrap( new OioServerSocketChannelFactory(executor, executor)); @@ -129,6 +129,11 @@ public class ServerBootstrapTest { // Wait until the child connection is closed in the client side. // We don't use Channel.close() to make sure it's closed automatically. + + while (pch.child.isOpen()) { + Thread.yield(); + } + while ("12".equals(pch.result.toString())) { Thread.yield(); } @@ -171,7 +176,6 @@ public class ServerBootstrapTest { public void childChannelClosed(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception { result.append('2'); - ctx.sendUpstream(e); } @Override @@ -179,7 +183,6 @@ public class ServerBootstrapTest { ChildChannelStateEvent e) throws Exception { child = e.getChildChannel(); result.append('1'); - ctx.sendUpstream(e); } } }