> You can't. This is the way messages are transfered using the TCP protocol. >> >> Must I put all the pieces of messages together by myself? >> > > Yes.
This is the classical difference when you move you move away from Stream interface in normal Java IO API to MINA This situation calls for the use of CumulativeProtocol Decoder. Once you collect all the packets, use the byte array. Please plan on some alternative way of storing received byte outside session, else with few concurrent sessions, you may run out of memory.
