server.start();
System.out.println("testManualConnectionContinueHeader server: " + server.getLocalPort());
HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
HttpRequestHeader requestHeader = new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test", "text/plain; charset=iso-8859-1");
requestHeader.setHeader("Expect", "100-Continue");
String data = "test1234567890";
ResponseHandler respHdl = new ResponseHandler(data);
BodyDataSink dataSink = con.send(requestHeader, respHdl);
respHdl.setBodyDataSink(dataSink);
dataSink.flush();
while ((respHdl.getLastResponse() == null) || (respHdl.getLastResponse().getStatus() == 100)) {
QAUtil.sleep(100);
}
QAUtil.sleep(300);
IHttpResponse response = respHdl.getLastResponse();
Assert.assertEquals(100, respHdl.getLastContinue().getStatus());
Assert.assertEquals("Continue", respHdl.getLastContinue().getReason());
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(data, response.getBlockingBody().readString());
con.close();
server.close();
}