问题描述:

When I try to make a websocket session through a Java application using WebSocketContainter.connectToServer everything seems to hang. I don't get any indication there was an exception, or that the connection was successfully made. My code doesn't execute past the connectToServer call.

 String DEFAULT_URI = "ws://blah/ws/test";

WebSocketContainer wsContainer = ContainerProvider.getWebSocketContainer();

Session session = wsContainer.connectToServer(MyClient.class, new URI(DEFAULT_URI));

//this line never gets executed. Session from above isn't returned nor is an error

System.out.println(session);

From this example, I'd expect some sort of connection error seeing that I'm trying to establish a connection to a websocket address that isn't valid. When using a valid ws address I also don't progress past getting the connection to return a session.

相关阅读:
Top