Fix encoding of test message.
Close socket immediately when rejecting connection.