assertTrue(latch.await(1, TimeUnit.SECONDS));
}
@Test
public void eventReceiptOnANYTypeEventHandler() throws InterruptedException {
EventDispatcher dispatcher = EventDispatchers
.newJetlangEventDispatcher(null, null);
final CountDownLatch latch = new CountDownLatch(5);
dispatcher.addHandler(new EventHandler() {
@Override
public void onEvent(Event event) {
latch.countDown();
}
@Override
public int getEventType() {
return Events.ANY;
}
});
Event event = Events.event(null, Events.SESSION_MESSAGE);
dispatcher.fireEvent(event);
event = Events.event(null, Events.NETWORK_MESSAGE);
dispatcher.fireEvent(event);
event = Events.event(null, Events.EXCEPTION);
dispatcher.fireEvent(event);
event = Events.event(null, Events.LOG_IN);
dispatcher.fireEvent(event);
event = Events.event(null, Events.CONNECT);
dispatcher.fireEvent(event);
assertTrue(latch.await(1, TimeUnit.SECONDS));
}