### Question:
WebSocketProxyServerHandler extends AbstractWebSocketHandler implements RoutedServicesUser { @Override public void handleMessage(WebSocketSession webSocketSession, WebSocketMessage<?> webSocketMessage) throws Exception { log.debug("handleMessage(session={},message={})", webSocketSession, webSocketMessage); WebSocketRoutedSession session = getRoutedSession(webSocketSession); if (session != null) { session.sendMessageToServer(webSocketMessage); } } @Autowired  WebSocketProxyServerHandler(DiscoveryClient discovery, SslContextFactoryProvider jettySslContextFactoryProvider);  WebSocketProxyServerHandler(DiscoveryClient discovery, SslContextFactoryProvider sslContextFactoryProvider,
                                       Map<String, WebSocketRoutedSession> routedSessions, WebSocketRoutedSessionFactory webSocketRoutedSessionFactory); void addRoutedServices(String serviceId, RoutedServices routedServices); Map<String, WebSocketRoutedSession> getRoutedSessions(); @Override void afterConnectionEstablished(WebSocketSession webSocketSession); @Override void afterConnectionClosed(WebSocketSession session, CloseStatus status); @Override void handleMessage(WebSocketSession webSocketSession, WebSocketMessage<?> webSocketMessage);  }### Answer:
@Test void givenValidSession_whenTheMessageIsReceived_thenTheMessageIsPassedToTheSession() throws Exception { WebSocketSession establishedSession = mock(WebSocketSession.class); String validSessionId = "123"; when(establishedSession.getId()).thenReturn(validSessionId); WebSocketRoutedSession internallyStoredSession = mock(WebSocketRoutedSession.class); routedSessions.put(validSessionId, internallyStoredSession); WebSocketMessage<String> passedMessage = mock(WebSocketMessage.class); underTest.handleMessage(establishedSession, passedMessage); verify(internallyStoredSession).sendMessageToServer(passedMessage); }