When we send many small 1K messages, the size of the ByteArrayOutputStream's underlying byte buffer will be 1K (before fragmentation). When we then send a 10MB message, the size is 10MB. When we subsequently only send 1K messages, the 10MB are still kept around.
SOLUTION: add option to create a new BAOS every time a message is fragmented.