RequestHandler2 reqHdl = new RequestHandler2();
HttpServer server = new HttpServer(reqHdl);
server.start();
HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
File file = QAUtil.createTestfile_4k();
FutureResponseHandler respHdl = new FutureResponseHandler();
BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), respHdl);
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel fc = raf.getChannel();
dataSink.transferFrom(fc);
fc.close();
raf.close();
dataSink.close();
IHttpResponse response = respHdl.getResponse();
Assert.assertEquals(200, response.getStatus());
Assert.assertTrue(QAUtil.isEquals(file, "ISO-8859-1", reqHdl.getData()));
file.delete();
con.close();
server.close();
}