IWSControllerMonitor implements IWSController { @Override public void handleOpenConnexion(Session session, EndpointConfig config) throws IOException { logger.debug("Decorate websocket, open connexion '{}'", session.getId()); Map<String, Object> configProperties = config.getUserProperties(); HandshakeRequest request = (HandshakeRequest) configProperties.get(Constants.HANDSHAKEREQUEST); httpSessionManager.addSession(session, ((HttpSession) request.getHttpSession()).getId()); iwse.handleOpenConnexion(session, config); }  @Override void handleOpenConnexion(Session session, EndpointConfig config); @Override void handleClosedConnexion(Session session, CloseReason closeReason);  }
@Test public void testHandleOpenConnexion() throws Exception { System.out.println("handleOpenConnexion"); Session session = mock(Session.class); EndpointConfig config = mock(EndpointConfig.class); HandshakeRequest handshakeRequest = mock(HandshakeRequest.class); HttpSession httpSession = mock(HttpSession.class); Map<String, Object> configProperties = mock(Map.class); when(config.getUserProperties()).thenReturn(configProperties); when(handshakeRequest.getHttpSession()).thenReturn(httpSession); when(httpSession.getId()).thenReturn("SESSIONID"); when(configProperties.get(eq(Constants.HANDSHAKEREQUEST))).thenReturn(handshakeRequest); instance.handleOpenConnexion(session, config); verify(httpSessionManager).addSession(eq(session), eq("SESSIONID")); verify(iwse).handleOpenConnexion(eq(session), eq(config)); }