I am trying to make a netty connection for a project and I am successfully able to make it. However, after 30 seconds the connection becomes inactive. I'm purposefully not using the connection for something because it is a test connection but I want to keep it active for future tasks even after 30 seconds are over. This is my code to create the connection:
try {
Bootstrap b = new Bootstrap();
b.option(ChannelOption.TCP_NODELAY, true);
b.option(ChannelOption.SO_KEEPALIVE, true);
b.group(new NioEventLoopGroup());
b.channel(NioSocketChannel.class);
b.handler(new ReadTimeoutHandler(50));
InetSocketAddress sa = new InetSocketAddress("--------IP HIDDEN--------", 25454);
ChannelFuture f = b.connect(sa.getAddress(), sa.getPort()).sync(); // (5)
Channel chan = f.channel();
//Channel becomes inactive after 30 seconds
} catch (Exception e) {
e.printStackTrace();
}