@Test public void testSend() throws InterruptedException { CountDownLatch done = new CountDownLatch(1); String sub1[] = new String[2]; EventBus eventBus = createEventBus(); eventBus.subscribe("a", (event, data) -> { sub1[0] = event; sub1[1] = data; done.countDown(); }); eventBus.send("a", "text", "data"); done.await(5, TimeUnit.SECONDS); assertEquals("text", sub1[0]); assertEquals("data", sub1[1]); }
@Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } }
SimpleEventBus implements EventBus { @Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } } }
SimpleEventBus implements EventBus { @Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } }  }
SimpleEventBus implements EventBus { @Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } }  @Override Subscription subscribe(String subscriberId, Subscription handler); @Override Subscription unsubscribe(String subscriberId); @Override void broadcast(String event, String data); @Override void send(String subscriberId, String event, String data); }
SimpleEventBus implements EventBus { @Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } }  @Override Subscription subscribe(String subscriberId, Subscription handler); @Override Subscription unsubscribe(String subscriberId); @Override void broadcast(String event, String data); @Override void send(String subscriberId, String event, String data);  }