def connect(self, timeout=1):
    '\n        Try to connect to server, return whether connection successful\n        '
    if self.isconnected():
        return True
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect(self.endpoint)
        self.socket = s
        _L.debug('BaseClient: wait for connection confirm')
        self.wait_connected.clear()
        isset = self.wait_connected.wait(timeout)
        assert (isset != None)
        if isset:
            return True
        else:
            self.socket = None
            _L.error('Socket is created, but can not get connection confirm from %s, timeout after %.2f seconds', self.endpoint, timeout)
            return False
    except Exception as e:
        _L.error('Can not connect to %s', str(self.endpoint))
        _L.error('Error %s', e)
        self.socket = None
        return False
Try to connect to server, return whether connection successful
def connect(self, timeout=1):
    '\n        \n        '
    if self.isconnected():
        return True
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect(self.endpoint)
        self.socket = s
        _L.debug('BaseClient: wait for connection confirm')
        self.wait_connected.clear()
        isset = self.wait_connected.wait(timeout)
        assert (isset != None)
        if isset:
            return True
        else:
            self.socket = None
            _L.error('Socket is created, but can not get connection confirm from %s, timeout after %.2f seconds', self.endpoint, timeout)
            return False
    except Exception as e:
        _L.error('Can not connect to %s', str(self.endpoint))
        _L.error('Error %s', e)
        self.socket = None
        return False