try {
c.prepareGet(urlTarget).execute().get();
c.prepareGet(urlTarget).execute().get();
//Suspend
Response r = c.prepareGet(urlTarget).addHeader(HeaderBroadcasterCache.HEADER_CACHE, String.valueOf(t1)).execute(new AsyncCompletionHandler<Response>() {
@Override
public Response onCompleted(Response r) throws Exception {
try {
return r;
} finally {
latch.countDown();
}
}
}).get();
try {
latch.await(20, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail(e.getMessage());
}
assertNotNull(r);
assertEquals(r.getStatusCode(), 200);
assertEquals(r.getResponseBody(), "1234567891012345678910");
} catch (Exception e) {
logger.error("test failed", e);
fail(e.getMessage());
}