io.netty.channel.writeAndFlush() delayed writes

Hello,

We are trying to implement the netty Client and want to read and write tags to the server.
We are observing delay in writes(5 minutes to be precise). And after 5 minutes, the writes do go through to the server, but upon analyzing the network trace through Wireshark, we see [TCP ZeroWindow] messages. Tried following some online solutions to force the writes even though it is inefficient. But those did not work.
Also, attaching the client code for reference. Could you please advise on this? Any pointers will be really helpful.

public final class Client {

    static final String HOST = System.getProperty("host", "127.0.0.1");
    static final int PORT = Integer.parseInt(System.getProperty("port", "10003"));
    static Bootstrap BOOTSTRAP = new Bootstrap();
    public static Channel ch;
    public static final ClientHandler HANDLER = new ClientHandler();
    public Client(TestDevice test_Device) throws InterruptedException {
        EventLoopGroup g = new NioEventLoopGroup();
        try {
        Bootstrap bootstrap = new Bootstrap();
        bootstrap.group(g)
                    .channel(NioSocketChannel.class)
                    .remoteAddress(HOST, PORT)
                    .handler(new ChannelInitializer<SocketChannel>() {
                        private ByteBuf[] delimiter() {
                            return new ByteBuf[] {
                                    Unpooled.wrappedBuffer(new byte[] { '\r' })

                            };
                        }
                        @Override
                        protected void initChannel(SocketChannel ch) throws Exception {
                          
                            ch.pipeline().addLast(new DelimiterBasedFrameDecoder(8192, false, delimiter()));
                            ch.pipeline().addLast(new io.netty.handler.codec.bytes.ByteArrayDecoder());
                            ch.pipeline().addLast(new io.netty.handler.codec.bytes.ByteArrayEncoder());
                            ch.pipeline().addLast(HANDLER);
                        }
                    });
        setBootstrap(bootstrap);
        setChannel(bootstrap);
      
         

        }
        finally {
//            g.shutdownGracefully();
                if(test_DEVICE.getStatus()!="Running")
                {
                    g.shutdownGracefully();
                }
        }
    }
    static void connect() {
        BOOTSTRAP.connect().addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                if (future.cause() != null) {
                    HANDLER.startTime = -1;
                    HANDLER.println("Failed to connect: " + future.cause());
                }
            }
        });
    }
    static void setBootstrap(Bootstrap bootstrap) {
        BOOTSTRAP = bootstrap;
    }
    static void setChannel(Bootstrap bootstrap) throws InterruptedException {
        ch=bootstrap.connect().channel();
    }
	public static boolean sendMessage(byte[] array) {

        if (array == null || array.length < 1)
            return false;

        ChannelFuture channelFuture = null;

        try {
				channelFuture = ch.writeAndFlush(Unpooled.wrappedBuffer(array));
                ChannelOutboundInvoker channelOutboundInvoker = ch.flush();
             
                channelFuture.addListener
                        ((ChannelFutureListener)channelFutureListener->Logger.getLogger("ClientHandler.netty.sendMessage")
                                .info("CF Listener"+channelFutureListener.isSuccess()));

        }
        catch(Exception ex)
        {
            Logger.getLogger("ClientHandler.netty.sendMessage").error(ex.getMessage());
        }
        if(channelFuture!=null)
        {
            Logger.getLogger("ClientHandler.netty.sendMessage").info("channel future success?="+channelFuture.isSuccess());
        }
        return true;
    }

    static Bootstrap getBootstrap() {
        return BOOTSTRAP;
    }
}





----------------------

public class ClientHandler extends SimpleChannelInboundHandler<byte[]>  {
	ChannelHandlerContext ctx = null;
	 @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        super.channelActive(ctx);
        this.ctx = ctx;
	}
	  @Override
    protected void channelRead0(ChannelHandlerContext ctx, byte[] msg) throws Exception {
		...
		getMessage(msg);

}}