@Test public void shouldEchoMessage() throws Exception { var mockSession = mock(WebSocketSession.class); var msg = new TextMessage("Hello World!"); handler.handleTextMessage(mockSession, msg); verify(mockSession, times(1)).sendMessage(eq(new TextMessage("RECEIVED: Hello World!"))); }
@Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { var msg = message.getPayload(); session.sendMessage(new TextMessage("RECEIVED: " + msg)); }
EchoHandler extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { var msg = message.getPayload(); session.sendMessage(new TextMessage("RECEIVED: " + msg)); } }
EchoHandler extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { var msg = message.getPayload(); session.sendMessage(new TextMessage("RECEIVED: " + msg)); }  }
EchoHandler extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { var msg = message.getPayload(); session.sendMessage(new TextMessage("RECEIVED: " + msg)); }  @Override void afterConnectionEstablished(WebSocketSession session); }
EchoHandler extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { var msg = message.getPayload(); session.sendMessage(new TextMessage("RECEIVED: " + msg)); }  @Override void afterConnectionEstablished(WebSocketSession session);  }