If FramedMessageChannel.receive is invoked with a buffer smaller than the current message, it will copy the first bytes of the message into the buffer, but it will keep its internal buffer pointing to the same buffer.
As a result, if a new attempt to read into a smaller buffer is performed again, FramedMessageChannel will read the first bytes of the same message again. And it will keep this behavior until a request to read into a buffer with an appropriate size is performed.
The correct (as discussed on IRC) should be truncating the message and moving to next message.
Plus, the value returned by receive must be the length of the message, regardless of the message being truncated.