@Test void onOpen() { webSocketEndpoint.onOpen(session, "user1"); Mockito.verify(broadcaster).addSession(session); Mockito.verify(broadcaster).broadcast("#User: user1 joined"); }
@OnOpen public void onOpen(Session session, @PathParam("username") String username) { sessions.put(username, session); broadcaster.addSession(session); broadcaster.broadcast("#User: " + username + " joined"); LOGGER.info(username + " is online!"); }
WebSocketEndpoint { @OnOpen public void onOpen(Session session, @PathParam("username") String username) { sessions.put(username, session); broadcaster.addSession(session); broadcaster.broadcast("#User: " + username + " joined"); LOGGER.info(username + " is online!"); } }
WebSocketEndpoint { @OnOpen public void onOpen(Session session, @PathParam("username") String username) { sessions.put(username, session); broadcaster.addSession(session); broadcaster.broadcast("#User: " + username + " joined"); LOGGER.info(username + " is online!"); }  }
WebSocketEndpoint { @OnOpen public void onOpen(Session session, @PathParam("username") String username) { sessions.put(username, session); broadcaster.addSession(session); broadcaster.broadcast("#User: " + username + " joined"); LOGGER.info(username + " is online!"); }  @OnOpen void onOpen(Session session, @PathParam("username") String username); @OnClose void onClose(Session session, @PathParam("username") String username); @OnError void onError(Session session, @PathParam("username") String username, Throwable throwable); @OnMessage void onMessage(String message, @PathParam("username") String username); }
WebSocketEndpoint { @OnOpen public void onOpen(Session session, @PathParam("username") String username) { sessions.put(username, session); broadcaster.addSession(session); broadcaster.broadcast("#User: " + username + " joined"); LOGGER.info(username + " is online!"); }  @OnOpen void onOpen(Session session, @PathParam("username") String username); @OnClose void onClose(Session session, @PathParam("username") String username); @OnError void onError(Session session, @PathParam("username") String username, Throwable throwable); @OnMessage void onMessage(String message, @PathParam("username") String username);  }