def on_connect(self, connection):
        "Called when the stream connects"
        self._stream = connection._reader
        self._buffer = SocketBuffer(self._stream, self._read_size)
        if connection.decode_responses:
            self.encoding = connection.encoding
Called when the stream connects