chain.addLast(new RequestHandler());
HttpServer server = new HttpServer(chain);
server.start();
HttpClient httpClient = new HttpClient();
FutureResponseHandler hdl = new FutureResponseHandler();
BodyDataSink ds = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test"), 100, hdl);
for (int i = 0; i < 10; i++) {
ds.write("0123456789");
}
ds.close();
IHttpResponse response = hdl.get();
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("true", response.getHeader("X-Intercepted"));
Assert.assertEquals(100, response.getBlockingBody().readBytes().length);
httpClient.close();
server.close();
}