How to get Netty websocket client example working
- by Paul Butcher
I'm struggling to get the netty example websocket client working. I've compiled successfully with 4.0.0.Alpha8, but when I try to connect to a server (also a netty example) I get:
Exception in thread "main" io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response upgrade: websocket
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.finishHandshake(WebSocketClientHandshaker13.java:204)
which makes no sense to me whatsoever, given that this piece of code reads:
String upgrade = response.getHeader(Names.UPGRADE);
if (!Values.WEBSOCKET.equalsIgnoreCase(upgrade)) {
throw new WebSocketHandshakeException("Invalid handshake response upgrade: "
+ response.getHeader(Names.UPGRADE));
}
And as the message in the exception demonstrates, the Upgrade header does contain websocket as expected.
Any idea what's going on?