I kept getting the IllegalStateException: "doDecode can't return true
when buffer is not consumed" from the CumulativeProtocolDecoder which
is used by the DemuxingProtocolCodec Factory (which I'm using in my
current project :). I think I narrowed down the problem to these
lines starting at about line 229 in DemuxingProtocolCodec.java:
int limit = in.limit();
in.position( 0 );
MessageDecoderResult result = decoder.decodable( session, in );
in.position( 0 );
in.limit( limit );
I changed the 2nd and 4th lines so that the code is now:
int limit = in.limit();
int pos = in.position();
MessageDecoderResult result = decoder.decodable( session, in );
in.position( pos );
in.limit( limit );
Admittingly, I do not know what all this affects but it seems like
that the in buffer shouldn't have its position set to zero everytime
you check to see if the decoder can decode the message. It seems
like the buffer will have more than just a single message starting at
zero. I changed my local copy and I do not get the exception
anymore. If this breaks design and my code has the fault, let me know.
Thanks,
Adam