I’m trying to run Netty Draft10 latest example on top of SSL (WSS)
I’m using the following port configuration:
Port: 80: Apache non ssl
Port: 443: Apache ssl
Port: 8080: Tomcat
Port: 8877: Netty Web non SS
Port: 9977: Netty SSL
But when I embedd the SSL handler code
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
//TODO - Tamir - Add support for Wss
// Get the SslHandler in the current pipeline.
// We added it in SecureChatPipelineFactory.
final SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
// Get notified when SSL handshake is done.
ChannelFuture handshakeFuture = sslHandler.handshake();
handshakeFuture.addListener(new Greeter(sslHandler));
}
into the WebSocketServerHandler class I get an error message
java.lang.IllegalArgumentException: empty text
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:95)
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:68)
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:81)
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:198)
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:107)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:470)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:275)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:262)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:340)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:271)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:191)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
java.lang.IllegalArgumentException: invalid version format: ?_?_?__
This is my pipeline code
SSLEngine engine =
SecureChatSslContextFactory.getServerContext().createSSLEngine();
engine.setUseClientMode(false);
pipeline.addLast("ssl", new SslHandler(engine));
// On top of the SSL handler, add the text line codec.
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", new WebSocketServerHandler());
Any ideas?
Cheers,
Tamir
I’ve just uploaded a working example of web sockets with SSL which I’ve merged with master.
See pull request: https://github.com/netty/netty/pull/53.
The new code is in src/main/java/org/jboss/netty/example/http/websocketx/sslserver
Please read package-info.java for setup instructions.
Let me know if it works for you.