diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java index d9af5953ca4..876db22112d 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java @@ -96,6 +96,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection _sslEndPoint = newSslEndPoint(); } + /* ------------------------------------------------------------ */ protected SslEndPoint newSslEndPoint() { return new SslEndPoint(); @@ -583,6 +584,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection return _sslEndPoint; } + /* ------------------------------------------------------------ */ public String toString() { return String.format("%s %s", super.toString(), _sslEndPoint); @@ -596,6 +598,11 @@ public class SslConnection extends AbstractConnection implements AsyncConnection { return _engine; } + + public AsyncEndPoint getEndpoint() + { + return _aEndp; + } public void shutdownOutput() throws IOException { @@ -822,5 +829,6 @@ public class SslConnection extends AbstractConnection implements AsyncConnection _ishut, _oshut, _connection); } + } } 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 96445f1fcf5..f01dfc831a8 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 @@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.io.EndPoint; +import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.util.IO; import org.junit.Assert; @@ -144,22 +145,19 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture // Get the server side endpoint EndPoint endp = endpoint.exchange(null,10,TimeUnit.SECONDS); + if (endp instanceof SslConnection.SslEndPoint) + endp=((SslConnection.SslEndPoint)endp).getEndpoint(); // read the response String result=IO.toString(is); Assert.assertThat("OK",result,containsString("200 OK")); - // check the server side is open and oshut and that client reads EOF - Assert.assertTrue(endp.isOpen()); - Assert.assertTrue(endp.isOutputShutdown()); - Assert.assertFalse(endp.isInputShutdown()); + // check client reads EOF assertEquals(-1, is.read()); // wait for idle timeout TimeUnit.MILLISECONDS.sleep(MAX_IDLE_TIME+MAX_IDLE_TIME/2); - // check the server side is closed - Assert.assertFalse(endp.isOpen()); // further writes will get broken pipe or similar try @@ -179,6 +177,8 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture { // expected } + // check the server side is closed + Assert.assertFalse(endp.isOpen()); } @Test @@ -227,16 +227,11 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture // read the response IO.toString(is); - // check the server side is open and oshut and that client reads EOF - Assert.assertTrue(endp.isOpen()); - Assert.assertTrue(endp.isOutputShutdown()); - Assert.assertFalse(endp.isInputShutdown()); + // check client reads EOF assertEquals(-1, is.read()); TimeUnit.MILLISECONDS.sleep(MAX_IDLE_TIME+MAX_IDLE_TIME/2); - // check the server side is closed - Assert.assertFalse(endp.isOpen()); // further writes will get broken pipe or similar try @@ -256,6 +251,9 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture { // expected } + + // check the server side is closed + Assert.assertFalse(endp.isOpen()); }