On Wed, Mar 25, 2015 at 2:37 PM, Mark Thomas <[email protected]> wrote:
> On 25/03/2015 18:08, Palmer Cox wrote:
>> Hi,
>>
>> No matter what I've tried,
>
> And the list members have no idea what you have tried since you haven't
> told us.
>
> Take a look at Tomcat's unit tests for WebSocket. There are a number of
> working examples you can use as a basis for you code.
Maybe I phrased my last email badly. Anyway, I have the following program:
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);
}
}
This works fine with Tyrus 1.10. However, when I run it with the
websocket libraries from Tomcat 8.0.20, I get:
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
I believe this is a bug in the tomcat websocket client libraries, right?
-Palmer Cox
> <snip/>
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]