IWSDecorator 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); sessionManager.linkWsToHttp(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); Map map = mock(Map.class); HandshakeRequest request = mock(HandshakeRequest.class); HttpSession httpSession = mock(HttpSession.class); when(session.getId()).thenReturn("WSID"); when(config.getUserProperties()).thenReturn(map); when(map.get(eq(Constants.HANDSHAKEREQUEST))).thenReturn(request); when(request.getHttpSession()).thenReturn(httpSession); when(httpSession.getId()).thenReturn("HTTPID"); instance.handleOpenConnexion(session, config); verify(sessionManager).linkWsToHttp(eq(session), eq("HTTPID")); verify(iwse).handleOpenConnexion(eq(session), eq(config)); }