HttpServer server = new HttpServer(outerChain);
server.start();
IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());
con.write("POST / HTTP/1.1\r\n" +
"Host: localhost\r\n" +
"User-Agent: me\r\n" +
"Expect: 100-Continue\r\n" +
"Content-Length: 2000\r\n" +
"\r\n");
String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
Assert.assertTrue(header.indexOf("100") != -1);
Assert.assertTrue(hdl.is100ContinueSent());
con.write(QAUtil.generateByteArray(2000));
header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
Assert.assertTrue(header.indexOf("200") != -1);
Assert.assertTrue(header.indexOf("X-Intercepted1") != -1);
Assert.assertTrue(header.indexOf("X-Intercepted2") != -1);
int length = QAUtil.readContentLength(header);
String txt = con.readStringByLength(length);
Assert.assertEquals("OK", txt);
con.close();
server.close();
}