4

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.

Rndm
  • 6,710
  • 7
  • 39
  • 58
magegu
  • 530
  • 4
  • 18

1 Answers1

5

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

Veebs
  • 2,390
  • 13
  • 10