publication time + TTL + latency */
private void checkPromptArrival(QueueingConsumer c,
int count, long latency) throws Exception {
long epsilon = TTL / 50;
for (int i = 0; i < count; i++) {
Delivery d = c.nextDelivery(TTL + TTL + latency + epsilon);
assertNotNull("message #" + i + " did not expire", d);
long now = System.currentTimeMillis();
long publishTime = Long.valueOf(new String(d.getBody()));
long targetTime = publishTime + TTL + latency;
assertTrue("expiry outside bounds (+/- " + epsilon + "): " +
(now - targetTime),
(now >= targetTime - epsilon) &&
(now <= targetTime + epsilon));