HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
FutureResponseHandler respHandler = new FutureResponseHandler();
BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/?isSuspend=true&durationMillis=2000"), respHandler);
StringBuilder sb = new StringBuilder();
for (int i = 1; i < 2; i++) {
String data = new String(QAUtil.generateByteArray(222000 * i));
sb.append(data);
dataSink.write(data);
QAUtil.sleep(200);
}
System.out.println("data sink close");
dataSink.close();
System.out.println("get response handle");
IHttpResponse response = respHandler.getResponse();
Assert.assertEquals(sb.toString(), response.getBlockingBody().readString());