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