I found that if I just use Java try and cache to get exception, it is unavailable to cache netty's exception, so any methods to get exception for client connecting, client disconnecting, even writing? here is my netty client code:
final String ip = "127.0.0.1";
final int port = 9001;
final EventLoopGroup g = new NioEventLoopGroup();
final Bootstrap b = new Bootstrap();
final ChannelFuture f = b.group(g)
.channel(NioSocketChannel.class)
.option(ChannelOption.TCP_NODELAY, true)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_KEEPALIVE, true)
.handler(new EchoClientInitializer())
.connect(ip, port)
.sync();
f.channel().closeFuture().sync();
g.shutdownGracefully();
Thank!