def connect_with_retry(addr):

    retry = 0
    while True:
        try:
            return socket.create_connection(addr)
        except socket.error, e:
            if e.errno != errno.ECONNREFUSED: raise
            if retry == 20: raise
            retry += 1
            time.sleep(0.05)
Helper: Repeatedly try to connect to the specified server socket
dataset/ETHPy150Open isislovecruft/obfsproxy/obfsproxy/test/tester.py/connect_with_retry