Skip to content
Advertisement

Netty, reading message results with IllegalReferenceCountgException refCnt: 0

I am new to netty and I try to receive byte response from a server (non-netty). However, I belvie I missundersteand the reference count. While reading the response I am running into the IllegalReferenceCountException: refCnt:0

What I do is not that complicated. I set up the client, then I send a message and I am awaiting a response.

My ResponseHandler looks like that:

JavaScript

while reading the response in channelRead the exception occurres. Why does it happen. Could someone explain it to me?

Advertisement

Answer

Okay, I solved the problem. Everything I need to do is add ByteToMessageDedcoder, otherwise the incoming response will never be allocated so it won’t be accessible.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement