use of org.apache.catalina.startup.BytesStreamer in project tomcat by apache.
the class TestNonBlockingAPI method testBug55438NonBlockingReadWriteEmptyRead.
@Test
public void testBug55438NonBlockingReadWriteEmptyRead() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
NBReadWriteServlet servlet = new NBReadWriteServlet();
String servletName = NBReadWriteServlet.class.getName();
Tomcat.addServlet(ctx, servletName, servlet);
ctx.addServletMappingDecoded("/", servletName);
tomcat.start();
Map<String, List<String>> resHeaders = new HashMap<>();
int rc = postUrl(false, new BytesStreamer() {
@Override
public byte[] next() {
return new byte[] {};
}
@Override
public int getLength() {
return 0;
}
@Override
public int available() {
return 0;
}
}, "http://localhost:" + getPort() + "/", new ByteChunk(), resHeaders, null);
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
}
Aggregations