// Setup consumers
MessageConsumer clientB = createConsumer("B", destA);
final long maxWait = 5 * 60 * 1000l;
MessageIdList listA = getConsumerMessages("A", clientA);
listA.setMaximumDuration(maxWait);
listA.waitForMessagesToArrive(numMessages);
MessageIdList listB = getConsumerMessages("B", clientB);
listB.setMaximumDuration(maxWait);
listB.waitForMessagesToArrive(numMessages);
assertEquals("got all on A" + listA.getMessageCount(),
numMessages, listA.getMessageCount());
assertEquals("got all on B" + listB.getMessageCount(),
numMessages, listB.getMessageCount());
}