So, as the title says, I'm inserting my own ChannelHandler (which extends ChannelInboundHandlerAdapter) into Minecraft.getMinecraft().getNetHandler().getNetworkManager().channel().pipeline(), but my handler's channelRead function never gets executed. I checked in minecraft code that I can get the proper channel (where are all of minecraft's ChannelHandlers) using method above, but apparently I can't. I don't know what am I doing wrong.
My goal is to create a clientside mod which, by intercepting packets, detects when the client doesn't get any packets from the server - that is, when a network lag occurs. (I'm currently writing it in my mod where I have all of my useful things - later I'll move it out to a separate mod.)
Class with events (LagEventHandlers) is properly registered in EVENT_BUS.
ChannelInboundHandlerAdapter only receives packets in pipeline, then after handling automatically releases them from the memory. I had to use ChannelDuplexHandler which is made exactly to intercept packets - it doesn't release them and it passes them to the next handler in pipeline.
Additionally, Minecraft's NetworkManager is a ChannelInboundHandlerAdapter so it autoreleases packets - I'm adding my handler before "packet_handler" (which is NetworkManager) using Pipeline.addBefore().