SynchronizedWithSynchronousDelivery handler = new SynchronizedWithSynchronousDelivery();
handlers.add(handler);
bus.subscribe(handler);
}
MessagePublication publication = null;
for(int i = 0; i < numberOfMessages; i++){
publication = bus.post(new Object()).asynchronously();
}
// wait for last publication
while (!publication.isFinished()){
pause(100);
}
for(SynchronizedWithSynchronousDelivery handler : handlers){
assertEquals(incrementsPerMessage * numberOfMessages, handler.counter);