IServer server = new HttpServer(0, chain);
ConnectionUtils.start(server);
PostRequest req = new PostRequest("http://localhost:" + server.getLocalPort() + "/", "text/plain", "test123456");
req.setHeader("Host", "localhost");
req.setHeader("User-Agent", "me");
IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
con.write(req.toString());
String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
Assert.assertTrue(header.indexOf("Transfer-Encoding: chunked") != -1);
int firstChunkLength = Integer.parseInt(con.readStringByDelimiter("\r\n"), 16);