Introduce the InvalidMessage exception.

It is thrown when the server cannot send a message, for example, if the
encoding is not UTF-8.