EventSocket extends WebSocketAdapter { @Override public void onWebSocketConnect(Session sess) { super.onWebSocketConnect(sess); listener = listenerFactory.createListener(sess); events.addClient(listener); } EventSocket(WsEventListener events);  EventSocket(WsEventListener events, SessionToListener listenerFactory); @Override void onWebSocketConnect(Session sess); @Override void onWebSocketText(String message); @Override void onWebSocketClose(int statusCode, String reason); @Override void onWebSocketError(Throwable cause);  }
@Test public void registers_a_listener_when_sockets_open() throws Exception { socket.onWebSocketConnect(session); verify(events).addClient(listener); }