assertFalse("Connection should NOT be closed", method.isConnectionCloseForced());
}
public void testNoContent() throws Exception {
// test with connection header
this.server.setRequestHandler(new HttpRequestHandler() {
public boolean processRequest(SimpleHttpServerConnection conn,
SimpleRequest request) throws IOException {
ResponseWriter out = conn.getWriter();
out.println("HTTP/1.1 204 NO CONTENT");
out.println();
out.flush();
return true;
}
});
GetMethod method = new GetMethod("/");
client.executeMethod(method);
method.getResponseBodyAsString();
assertTrue(connectionManager.getConection().isOpen());
// test without connection header
this.server.setRequestHandler(new HttpRequestHandler() {
public boolean processRequest(SimpleHttpServerConnection conn,
SimpleRequest request) throws IOException {
ResponseWriter out = conn.getWriter();
out.println("HTTP/1.1 204 NO CONTENT");
out.println("Connection: keep-alive");