}
});
// Let Atmosphere suspend the connections.
Thread.sleep(2500);
Response r = c.preparePost(urlTarget + "/programmaticDelayBroadcast").addParameter("message", "foo").execute().get();
assertEquals(r.getStatusCode(), 200);
r = c.preparePost(urlTarget + "/publishAndResume").addParameter("message", "bar").execute().get();
assertEquals(r.getStatusCode(), 200);
try {
latch.await(20, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail(e.getMessage());
}
r = response.get();
assertNotNull(r);
assertEquals("foobar", r.getResponseBody().trim());
assertEquals(r.getStatusCode(), 200);
} catch (Exception e) {
logger.error("test failed", e);
fail(e.getMessage());
}
c.close();