test(scheme, host, method.asString(), clientClose, serverClose, contentLength, true, latch, failures);
}
private void test(String scheme, String host, String method, boolean clientClose, boolean serverClose, int contentLength, final boolean checkContentLength, final CountDownLatch latch, final List<String> failures) throws InterruptedException
{
Request request = client.newRequest(host, connector.getLocalPort())
.scheme(scheme)
.method(method);
if (clientClose)
request.header(HttpHeader.CONNECTION, "close");
else if (serverClose)
request.header("X-Close", "true");
switch (method)
{
case "GET":
request.header("X-Download", String.valueOf(contentLength));
break;
case "POST":
request.header("X-Upload", String.valueOf(contentLength));
request.content(new BytesContentProvider(new byte[contentLength]));
break;
}
final CountDownLatch requestLatch = new CountDownLatch(1);
request.send(new Response.Listener.Adapter()
{
private final AtomicInteger contentLength = new AtomicInteger();
@Override
public void onHeaders(Response response)