final AsyncResult<org.deftserver.web.http.client.HttpResponse> cb =
new AsyncResult<org.deftserver.web.http.client.HttpResponse>() {
public void onSuccess(org.deftserver.web.http.client.HttpResponse response) { }
public void onFailure(Throwable e) { if (e instanceof ConnectException) latch.countDown(); }
};
// make sure that the http.fetch(..) is invoked from the ioloop thread
IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { http.fetch(url, cb); }});
latch.await(5, TimeUnit.SECONDS);
assertEquals(0, latch.getCount());