ConnectivityManager { public void publishConnect(String sessionId) { for (ConnectListener listener : listeners) { listener.onConnect(sessionId); } } ConnectivityManager(); void register(ConnectListener listener); void publishConnect(String sessionId); void publishDisconnect(boolean closedByServer); void publishConnectError(Throwable websocketException); Boolean unRegister(ConnectListener listener);  }
@Test public void testConnectEvent() { manager.publishConnect("sessionId"); verify(listener, only()).onConnect(stringCaptor.capture()); String id = stringCaptor.getValue(); assertThat(id, is(equalTo("sessionId"))); }