From bc35807525cded020ee8bf7be37af142657efbbf Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 17 Sep 2012 16:21:53 +0200 Subject: [PATCH] jetty-9 - Fixed test. --- .../jetty/server/ConnectorTimeoutTest.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java index 7711bd7f52d..66c9365c262 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java @@ -18,10 +18,6 @@ package org.eclipse.jetty.server; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.matchers.JUnitMatchers.containsString; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -29,7 +25,6 @@ import java.net.Socket; import java.net.SocketException; import java.util.concurrent.Exchanger; import java.util.concurrent.TimeUnit; - import javax.net.ssl.SSLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -42,6 +37,11 @@ import org.eclipse.jetty.util.IO; import org.junit.Assert; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.matchers.JUnitMatchers.containsString; + public abstract class ConnectorTimeoutTest extends HttpServerTestFixture { protected static final int MAX_IDLE_TIME=500; @@ -169,7 +169,6 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture // wait for idle timeout TimeUnit.MILLISECONDS.sleep(3 * MAX_IDLE_TIME); - // further writes will get broken pipe or similar try { @@ -240,6 +239,9 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture // check client reads EOF assertEquals(-1, is.read()); + assertTrue(endPoint.isOutputShutdown()); + + Thread.sleep(2 * MAX_IDLE_TIME); // further writes will get broken pipe or similar try @@ -256,12 +258,12 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture catch(SocketException e) { // expected - + // Give the SSL onClose time to act Thread.sleep(100); } - // check the server side is closed + // check the server side is closed Assert.assertFalse(endPoint.isOpen()); } @@ -342,7 +344,6 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture Assert.assertFalse(endPoint.isOpen()); } - @Test public void testMaxIdleNoRequest() throws Exception {