Fixes BufferUnderflowException when a message is
splitted over multiple ByteBuffers and avoids reading of
garbage when a message fits into a single ByteBuffer backed
by an array which is larger than the message.