// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
tomcat.start();
ByteChunk res = new ByteChunk();
try {
getUrl("http://localhost:" + getPort()
+ "/test/bug5nnnn/bug56581.jsp", res, null);
Assert.fail("An IOException was expected.");
} catch (IOException expected) {
// ErrorReportValve in Tomcat 7.0.55+, 8.0.9+ flushes and aborts the
// connection when an unexpected error is encountered and response
// has already been committed. It results in an exception here:
// java.io.IOException: Premature EOF
}
String result = res.toString();
assertTrue(result.startsWith("0 Hello world!\n"));
assertTrue(result.endsWith("999 Hello world!\n"));
}