Reputation: 530
I want to use netty for websockets with TLS enabled and using the (wss://) schema.
So I figured I should work like this: the WebSocketServerHandler should now extend theSslHandler. So I basically only have to set up an SSLEngine wihin the WebSocketServerPipelineFactory. I can than pass the engine to the secure handler:
SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
pipeline.addLast("handler", new WebSocketServerHandler(sslEngine));
Is this approach in general the right one and (if the approach is correct) - how do I set up the SSLEngine (I've my certificate & private/public keys as files available). I couldn't find any example!
Thanks.
Upvotes: 4
Views: 4482
Reputation: 2388
Netty has examples :-)
Netty Master https://github.com/netty/netty/tree/master/example/src/main/java/io/netty/example/http/websocketx/sslserver
Netty 3.x Branch https://github.com/netty/netty/tree/3/src/main/java/org/jboss/netty/example/http/websocketx/sslserver
Upvotes: 5