Empty the buffer once the whole handshake response has been received by the client, else HTTP headers are published as messages.
Switch to using event objects.