diff --git a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java index d56a87f9a29..c9160432cc1 100644 --- a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java +++ b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java @@ -30,6 +30,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; + import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -264,15 +265,18 @@ public class ProxyServletFailureTest @Override protected ContentProvider proxyRequestContent(HttpServletRequest request, HttpServletResponse response, Request proxyRequest) throws IOException { - return new DeferredContentProvider() + DeferredContentProvider provider = new DeferredContentProvider() { @Override public boolean offer(ByteBuffer buffer, Callback callback) { - // Ignore all content to trigger the test condition. - return true; + // Send less content to trigger the test condition. + buffer.limit(buffer.limit() - 1); + return super.offer(buffer.slice(), callback); } }; + request.getInputStream().setReadListener(newReadListener(request, response, proxyRequest, provider)); + return provider; } }; } @@ -305,12 +309,7 @@ public class ProxyServletFailureTest .content(new BytesContentProvider(content)) .send(); - // TODO which is correct? - if (proxyServlet instanceof AsyncProxyServlet) - Assert.assertEquals(502, response.getStatus()); - else - Assert.assertEquals(500, response.getStatus()); - + Assert.assertEquals(500, response.getStatus()); } @Test(expected = TimeoutException.class)