Correct handshake to have text/plain and a valid response
Export Message and encode/decode; improve error diagnostics