### Question:
EngineIoServer extends Emitter { public void handleWebSocket(EngineIoWebSocket webSocket) { final Map<String, String> query = webSocket.getQuery(); final String sid = query.get("sid"); if(sid != null) { EngineIoSocket socket = mClients.get(sid); if(socket == null) { webSocket.close(); } else if(!socket.canUpgrade(WebSocket.NAME)) { webSocket.close(); } else { Transport transport = new WebSocket(webSocket); socket.upgrade(transport); } } else { handshakeWebSocket(webSocket); } } EngineIoServer();  EngineIoServer(EngineIoServerOptions options); EngineIoServerOptions getOptions(); @Deprecated long getPingTimeout(); @Deprecated long getPingInterval(); void handleRequest(HttpServletRequest request, HttpServletResponse response); void handleWebSocket(EngineIoWebSocket webSocket);  }### Answer:
@Test public void testHandleWebSocket_connect() { final EngineIoServer server = new EngineIoServer(); final EngineIoWebSocket webSocket = new WebSocketConnectionStub(); final Emitter.Listener connectionListener = Mockito.mock(Emitter.Listener.class); server.on("connection", connectionListener); server.handleWebSocket(webSocket); Mockito.verify(connectionListener, Mockito.times(1)) .call(Mockito.any(EngineIoSocket.class)); }