assertEquals(5, method.getResponseContentLength());
}
public void testProxyNoContentLength() throws Exception {
// test with proxy-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 200 OK");
out.println("proxy-connection: keep-alive");
out.println();
out.println("12345");
out.flush();
return true;
}
});
client.getHostConfiguration().setProxy(server.getLocalAddress(), server.getLocalPort());
GetMethod method = new GetMethod("/");
client.executeMethod(method);
method.getResponseBodyAsString();
assertFalse(connectionManager.getConection().isOpen());
// test without proxy-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 200 OK");
out.println();