async def _wait_nghttpd(self, proc):
        """Wait for nghttpd to start listening on its designated port"""
        data = bytes()
        while data is not None:
            data = await proc.stdout.readline()
            if not data:
                # Process terminated
                return False

            line = data.decode("utf-8").rstrip()
            if "listen 0.0.0.0:8443" in line:
                return True

        return False
Wait for nghttpd to start listening on its designated port
tests/test_impersonate.py