ConnectivityManager { public void publishConnectError(Throwable websocketException) { for (ConnectListener listener : listeners) { listener.onConnectError(websocketException); } } ConnectivityManager(); void register(ConnectListener listener); void publishConnect(String sessionId); void publishDisconnect(boolean closedByServer); void publishConnectError(Throwable websocketException); Boolean unRegister(ConnectListener listener);  }
@Test public void testConnectErrorEvent() { Throwable throwable = new IOException("IOException"); manager.publishConnectError(throwable); verify(listener, only()).onConnectError(throwableCaptor.capture()); assertThat(throwableCaptor.getValue(), is(equalTo(throwable))); }