Debugging message corruption in the protocol
- lock write message, as it can be called from different threads.
- log the amount of bytes received on the transport.
Debuging