List of usage examples for io.netty.handler.ssl SslHandler close
@Deprecated
public ChannelFuture close()
From source file:org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection.java
License:Apache License
private void closeSSLAndChannel(SslHandler sslHandler, Channel channel) { if (sslHandler != null) { try {/* ww w.ja v a2 s . co m*/ ChannelFuture sslCloseFuture = sslHandler.close(); if (!sslCloseFuture.awaitUninterruptibly(10000)) { ActiveMQClientLogger.LOGGER.timeoutClosingSSL(); } } catch (Throwable t) { // ignore } } ChannelFuture closeFuture = channel.close(); if (!closeFuture.awaitUninterruptibly(10000)) { ActiveMQClientLogger.LOGGER.timeoutClosingNettyChannel(); } }
From source file:org.hornetq.core.remoting.impl.netty.NettyConnection.java
License:Apache License
private void closeSSLAndChannel(SslHandler sslHandler, Channel channel) { if (sslHandler != null) { try {//from w w w. j a va 2 s . co m ChannelFuture sslCloseFuture = sslHandler.close(); if (!sslCloseFuture.awaitUninterruptibly(10000)) { HornetQClientLogger.LOGGER.timeoutClosingSSL(); } } catch (Throwable t) { // ignore } } ChannelFuture closeFuture = channel.close(); if (!closeFuture.awaitUninterruptibly(10000)) { HornetQClientLogger.LOGGER.timeoutClosingNettyChannel(); } }
From source file:org.waarp.common.crypto.ssl.WaarpSslUtility.java
License:Open Source License
/** * Remove the SslHandler (if any) cleanly * // w w w . j av a 2 s . c om * @param future * if not null, wait for this future to be done to removed the sslhandler * @param channel * @param close * True to close the channel, else to only remove it */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static void removingSslHandler(ChannelFuture future, final Channel channel, final boolean close) { if (channel.isActive()) { channel.config().setAutoRead(true); ChannelHandler handler = channel.pipeline().first(); if (handler instanceof SslHandler) { final SslHandler sslHandler = (SslHandler) handler; if (future != null) { future.addListener(new GenericFutureListener() { public void operationComplete(Future future) throws Exception { logger.debug("Found SslHandler and wait for Ssl.close()"); sslHandler.close().addListener(new GenericFutureListener<Future<? super Void>>() { public void operationComplete(Future<? super Void> future) throws Exception { logger.debug("Ssl closed"); if (!close) { channel.pipeline().remove(sslHandler); } else { channel.close(); } } }); } }); } else { logger.debug("Found SslHandler and wait for Ssl.close() : " + channel); sslHandler.close().addListener(new GenericFutureListener<Future<? super Void>>() { public void operationComplete(Future<? super Void> future) throws Exception { logger.debug("Ssl closed: " + channel); if (!close) { channel.pipeline().remove(sslHandler); } else { channel.close(); } } }); } } else { channel.close(); } } }