def can_connect(port):
    sock = socket.socket()
    sock.settimeout(0.1)  # Always localhost, should be wayy faster than this.
    try:
        sock.connect(('127.0.0.1', port))
        return True
    except __HOLE__:
        return False
dataset/ETHPy150Open dcos/dcos/pytest/test_ssh_integration.py/can_connect