"Connection to AUT refused"

Last edited on


“Connection to AUT refused” when trying to launch or attach an Application, that is started on a device.

Possible Explanation

The device or the application on it is not reachable per TCP/IP.

The code below can be used to check if the AUT on the device is reachable at all.

# -*- coding: utf-8 -*-

import socket

def main():
    test_connection('localhost', 5555)
def testConnection(host, port):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
            sock.connect((host, port))           
            rec = sock.recv(4096)
            test.passes("Connection successfully established")
            test.compare(rec.decode("utf-8"),"squishattachwatcher", "Found attachable AUT")
        except socket.error as e:
            test.fail("Connection failed", e.strerror)
        except Exception as e: