@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { SocketChannel childChannel = (SocketChannel) msg; childChannel.config().setSoLinger(0); childChannel.unsafe().closeForcibly(); } }).childHandler(new ChannelInboundHandlerAdapter());
config.setKeepAlive(options.keepAlive()); config.setReuseAddress(options.reuseAddr()); config.setSoLinger(options.linger()); config.setTcpNoDelay(options.tcpNoDelay());
config.setKeepAlive(options.keepAlive()); config.setReuseAddress(options.reuseAddr()); config.setSoLinger(options.linger()); config.setTcpNoDelay(options.tcpNoDelay());
@Override public void initChannel(final SocketChannel ch) throws Exception { if(nettyOptions != null) { SocketChannelConfig config = ch.config(); config.setReceiveBufferSize(nettyOptions.rcvbuf()); config.setSendBufferSize(nettyOptions.sndbuf()); config.setKeepAlive(nettyOptions.keepAlive()); config.setReuseAddress(nettyOptions.reuseAddr()); config.setSoLinger(nettyOptions.linger()); config.setTcpNoDelay(nettyOptions.tcpNoDelay()); } if (log.isDebugEnabled()) { log.debug("CONNECT {}", ch); } if (null != getSslOptions()) { SSLEngine ssl = new SSLEngineSupplier(getSslOptions(), false).get(); if (log.isDebugEnabled()) { log.debug("SSL enabled using keystore {}", (null != getSslOptions().keystoreFile() ? getSslOptions().keystoreFile() : "<DEFAULT>")); } ch.pipeline().addLast(new SslHandler(ssl)); } if (null != nettyOptions && null != nettyOptions.pipelineConfigurer()) { nettyOptions.pipelineConfigurer().accept(ch.pipeline()); } bindChannel(handler, ch); } });