diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/AbstractHttpTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/AbstractHttpTest.java index 94b969dfbcd..1599c365561 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/AbstractHttpTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/AbstractHttpTest.java @@ -66,7 +66,7 @@ public abstract class AbstractHttpTest { server = new Server(); connector = new ServerConnector(server,null,null,new ArrayByteBufferPool(64,2048,64*1024),1,1,new HttpConnectionFactory()); - connector.setIdleTimeout(100000); + connector.setIdleTimeout(10000); server.addConnector(connector); stacklessChannelLogging =new StacklessLogging(HttpChannel.class); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java index f1ae0e537cd..2fb52dc9f38 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java @@ -33,6 +33,8 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpTester; import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -419,6 +421,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest } @Test + @Ignore("Not implemented in Jetty 9.3 (Proper support present in Jetty 9.4+)") public void testSetContentLengthFlushAndWriteInsufficientBytes() throws Exception { server.setHandler(new SetContentLengthAndWriteInsufficientBytesHandler(true)); @@ -434,6 +437,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest } @Test + @Ignore("Not implemented in Jetty 9.3 (Proper support present in Jetty 9.4+)") public void testSetContentLengthAndWriteInsufficientBytes() throws Exception { server.setHandler(new SetContentLengthAndWriteInsufficientBytesHandler(false)); @@ -469,7 +473,26 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest assertThat("response code", response.getStatus(), is(200)); assertThat("response body", response.getContent(), is("foo")); } - + + private class SetContentLengthAndWriteInsufficientBytesHandler extends AbstractHandler + { + boolean flush; + private SetContentLengthAndWriteInsufficientBytesHandler(boolean flush) + { + this.flush = flush; + } + + @Override + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + { + baseRequest.setHandled(true); + response.setContentLength(6); + if (flush) + response.flushBuffer(); + response.getWriter().write("foo"); + } + } + private class SetContentLengthAndWriteThatAmountOfBytesHandler extends ThrowExceptionOnDemandHandler { private SetContentLengthAndWriteThatAmountOfBytesHandler(boolean throwException)