https://bz.apache.org/bugzilla/show_bug.cgi?id=57761
Bug ID: 57761
Summary: WebSocket client won't connect to URLs that don't end
in a slash (/)
Product: Tomcat 8
Version: trunk
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: WebSocket
Assignee: [email protected]
Reporter: [email protected]
The following program won't work on Tomcat's WebSocket client jars, both 8.0.20
and Trunk:
public class App2 {
@ClientEndpoint
public static class Client {
@OnOpen
public void onOpen(Session s) throws Exception {
System.out.println("Sending PING");
s.getBasicRemote().sendText("PING");
}
@OnMessage
public void onMessage(Session s, String msg) throws Exception {
System.out.println("GOT: " + msg);
Thread.sleep(1000);
s.getBasicRemote().sendText("PING");
System.out.println("Sending PING");
}
}
public static void main(final String[] args) throws Exception {
ContainerProvider.getWebSocketContainer().connectToServer(
Client.class,
URI.create("ws://echo.websocket.org"));
Thread.sleep(Long.MAX_VALUE);
}
}
It fails with:
Exception in thread "main" javax.websocket.DeploymentException: The
HTTP request to initiate the WebSocket connection failed
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:357)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:164)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:181)
at io.davinci.test_sync_gateway_websocket.App2.main(App2.java:31)
Caused by: java.io.EOFException
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:606)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:309)
... 3 more
If you add a slash to the end of the URL, however, it connects.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]