Merge branch 'jetty-8' into release-8

This commit is contained in:
Jesse McConnell 2011-12-22 13:31:58 -06:00
commit 9b592b7542
2 changed files with 18 additions and 12 deletions

View File

@ -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);
}
}
}

View File

@ -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());
}