List of usage examples for io.netty.handler.ssl SslHandler setHandshakeTimeoutMillis
public void setHandshakeTimeoutMillis(long handshakeTimeoutMillis)
From source file:com.king.platform.net.http.netty.SslInitializer.java
License:Apache License
public SslHandler createSslHandler(String peerHost, int peerPort) throws IOException, GeneralSecurityException { SSLEngine sslEngine = sslFactory.newSSLEngine(peerHost, peerPort); SslHandler sslHandler = new SslHandler(sslEngine); if (handshakeTimeout > 0) { sslHandler.setHandshakeTimeoutMillis(handshakeTimeout); }/*w w w.ja v a 2s . c o m*/ return sslHandler; }
From source file:io.gatling.http.client.impl.SslHandlers.java
License:Apache License
private static SslHandler createSslHandler(SslContext sslContext, String peerHost, int peerPort, ByteBufAllocator allocator, HttpClientConfig config) { SSLEngine sslEngine = config.isEnableSni() ? sslContext.newEngine(allocator, Tls.domain(peerHost), peerPort) : sslContext.newEngine(allocator); sslEngine.setUseClientMode(true);// w w w. j a v a 2 s . c o m if (config.isEnableHostnameVerification()) { SSLParameters params = sslEngine.getSSLParameters(); params.setEndpointIdentificationAlgorithm("HTTPS"); sslEngine.setSSLParameters(params); } SslHandler sslHandler = new SslHandler(sslEngine); if (config.getHandshakeTimeout() > 0) sslHandler.setHandshakeTimeoutMillis(config.getHandshakeTimeout()); return sslHandler; }
From source file:org.asynchttpclient.netty.channel.ChannelManager.java
License:Open Source License
private SslHandler createSslHandler(String peerHost, int peerPort) { SSLEngine sslEngine = sslEngineFactory.newSslEngine(config, peerHost, peerPort); SslHandler sslHandler = new SslHandler(sslEngine); if (handshakeTimeout > 0) sslHandler.setHandshakeTimeoutMillis(handshakeTimeout); return sslHandler; }
From source file:org.asynchttpclient.providers.netty.channel.ChannelManager.java
License:Open Source License
public SslHandler createSslHandler(String peerHost, int peerPort) throws IOException, GeneralSecurityException { SSLEngine sslEngine = null;/* w w w . j a v a 2 s .c o m*/ if (nettyConfig.getSslEngineFactory() != null) { sslEngine = nettyConfig.getSslEngineFactory().newSSLEngine(); } else { SSLContext sslContext = config.getSSLContext(); if (sslContext == null) sslContext = SslUtils.getInstance().getSSLContext(config.isAcceptAnyCertificate()); sslEngine = sslContext.createSSLEngine(peerHost, peerPort); sslEngine.setUseClientMode(true); } SslHandler sslHandler = new SslHandler(sslEngine); if (handshakeTimeout > 0) sslHandler.setHandshakeTimeoutMillis(handshakeTimeout); return sslHandler; }
From source file:org.asynchttpclient.providers.netty.channel.Channels.java
License:Apache License
public SslHandler createSslHandler(String peerHost, int peerPort) throws IOException, GeneralSecurityException { SSLEngine sslEngine = null;//from ww w . j av a 2s . co m if (nettyProviderConfig.getSslEngineFactory() != null) { sslEngine = nettyProviderConfig.getSslEngineFactory().newSSLEngine(); } else { SSLContext sslContext = config.getSSLContext(); if (sslContext == null) sslContext = SslUtils.getInstance().getSSLContext(config.isAcceptAnyCertificate()); sslEngine = sslContext.createSSLEngine(peerHost, peerPort); sslEngine.setUseClientMode(true); } SslHandler sslHandler = new SslHandler(sslEngine); if (handshakeTimeoutInMillis > 0) sslHandler.setHandshakeTimeoutMillis(handshakeTimeoutInMillis); return sslHandler; }
From source file:org.asynchttpclient.providers.netty4.channel.ChannelManager.java
License:Open Source License
public SslHandler createSslHandler(String peerHost, int peerPort) throws IOException, GeneralSecurityException { SSLEngine sslEngine = sslEngineFactory.newSSLEngine(peerHost, peerPort); SslHandler sslHandler = new SslHandler(sslEngine); if (handshakeTimeout > 0) sslHandler.setHandshakeTimeoutMillis(handshakeTimeout); return sslHandler; }
From source file:org.eclipse.californium.elements.tcp.TlsClientConnector.java
License:Open Source License
@Override protected void onNewChannelCreated(SocketAddress remote, Channel ch) { SSLEngine sslEngine = createSllEngine(remote); sslEngine.setUseClientMode(true);/* ww w. ja v a 2 s. c o m*/ SslHandler sslHandler = new SslHandler(sslEngine); sslHandler.setHandshakeTimeoutMillis(handshakeTimeoutMillis); ch.pipeline().addFirst(sslHandler); }
From source file:org.eclipse.californium.elements.tcp.TlsServerConnector.java
License:Open Source License
@Override protected void onNewChannelCreated(Channel ch) { SSLEngine sslEngine = createSllEngineForChannel(ch); switch (clientAuthMode) { case NONE://w w w. ja v a2s .c om break; case WANTED: sslEngine.setWantClientAuth(true); break; case NEEDED: sslEngine.setNeedClientAuth(true); break; } sslEngine.setUseClientMode(false); SslHandler sslHandler = new SslHandler(sslEngine); sslHandler.setHandshakeTimeoutMillis(handshakeTimeoutMillis); ch.pipeline().addFirst(sslHandler); }
From source file:reactor.ipc.netty.options.NettyOptions.java
License:Open Source License
/** * Return a new eventual {@link SslHandler} * * @param allocator {@link ByteBufAllocator} to allocate for packet storage * * @return a new eventual {@link SslHandler} *///w w w . ja va 2 s . c om public final SslHandler getSslHandler(ByteBufAllocator allocator) { if (sslContext == null) { return null; } Objects.requireNonNull(allocator, "allocator"); SslHandler sslHandler = sslContext.newHandler(allocator); sslHandler.setHandshakeTimeoutMillis(sslHandshakeTimeoutMillis); return sslHandler; }