List of usage examples for io.netty.handler.ssl.util SelfSignedCertificate privateKey
File privateKey
To view the source code for io.netty.handler.ssl.util SelfSignedCertificate privateKey.
Click Source Link
From source file:ws.wamp.jawampa.transport.netty.SimpleWampWebsocketListener.java
License:Apache License
public void start() { if (state != State.Intialized) return;/*www .ja v a2 s . co m*/ try { // Initialize SSL when required if (uri.getScheme().equalsIgnoreCase("wss") && sslCtx == null) { // Use a self signed certificate when we got none provided through the constructor SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey()); } // Use well-known ports if not explicitly specified final int port; if (uri.getPort() == -1) { if (sslCtx != null) port = 443; else port = 80; } else port = uri.getPort(); ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, clientGroup).channel(NioServerSocketChannel.class) .childHandler(new WebSocketServerInitializer(uri, sslCtx)); channel = b.bind(uri.getHost(), port).sync().channel(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:ws.wamp.jawampa.transport.SimpleWampWebsocketListener.java
License:Apache License
public void start() { if (state != State.Intialized) return;/*from ww w. ja v a2 s. co m*/ try { // Initialize SSL when required if (uri.getScheme().equalsIgnoreCase("wss") && sslCtx == null) { // Use a self signed certificate when we got none provided through the constructor SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey()); } // Use well-known ports if not explicitly specified final int port; if (uri.getPort() == -1) { if (sslCtx != null) port = 443; else port = 80; } else port = uri.getPort(); ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, clientGroup).channel(NioServerSocketChannel.class) .childHandler(new WebSocketServerInitializer(uri, sslCtx)); channel = b.bind(uri.getHost(), port).sync().channel(); } catch (Exception e) { throw new RuntimeException(e); } finally { } }