List of usage examples for io.netty.handler.ssl.util SelfSignedCertificate certificate
File certificate
To view the source code for io.netty.handler.ssl.util SelfSignedCertificate certificate.
Click Source Link
From source file:ws.wamp.jawampa.transport.netty.SimpleWampWebsocketListener.java
License:Apache License
public void start() { if (state != State.Intialized) return;/*from w ww . j a v a2s . c o 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;/*ww w .j av a2 s. c o 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 { } }