ConnectivityManager { public void publishDisconnect(boolean closedByServer) { for (ConnectListener listener : listeners) { listener.onDisconnect(closedByServer); } } ConnectivityManager(); void register(ConnectListener listener); void publishConnect(String sessionId); void publishDisconnect(boolean closedByServer); void publishConnectError(Throwable websocketException); Boolean unRegister(ConnectListener listener);  }
@Test public void testDisconnectEvent() { manager.publishDisconnect(true); manager.publishDisconnect(false); verify(listener, times(2)).onDisconnect(booleanCaptor.capture()); assertThat(booleanCaptor.getAllValues().get(0), is(equalTo(true))); assertThat(booleanCaptor.getAllValues().get(1), is(equalTo(false))); }