def on_connect(self, connection):
    'Called when the socket connects'
    self._sock = connection._sock
    self._buffer = SocketBuffer(self._sock, self.socket_read_size)
    if connection.decode_responses:
        self.encoding = connection.encoding
Called when the socket connects
def on_connect(self, connection):
    
    self._sock = connection._sock
    self._buffer = SocketBuffer(self._sock, self.socket_read_size)
    if connection.decode_responses:
        self.encoding = connection.encoding