Set encoding with the gateway connection closed

A NetConnection.objectEncoding is only reliably writable on a closed connection.
changing it after the connection is made will change the encoding of the data objects, but leave the response envelope in the previous encoding, creating a mismatch.