It is a spec requirement that the server's copy of a message cannot be modified by the
client after it is sent or when it is received.
I would consider a patch that disables the clone - serialize/deserialize
for the JVM/IL.
It would require that the clients using this ConnectionFactory don't try to modify the
message after it is sent to the server. And the same after a client does a receive,
although an optimization is possible on the receiving side since it is effectively delivered as
I get it. That would probably be asking too much of the clients - knowing that they can't modify the object. Maybe another way to optimize it could be calling clone() if Cloneable is implemented, or else take the hit with the current impl - (de)serialization?