| 113 | |
| 114 | @classmethod |
| 115 | def setUpClass(cls): |
| 116 | super().setUpClass() |
| 117 | |
| 118 | # Ignore deprecation warnings raised by mitmproxy at run time. |
| 119 | warnings.filterwarnings( |
| 120 | "ignore", category=DeprecationWarning, module="mitmproxy" |
| 121 | ) |
| 122 | |
| 123 | cls.proxy_ready = threading.Event() |
| 124 | cls.proxy_thread = threading.Thread(target=asyncio.run, args=(cls.run_proxy(),)) |
| 125 | cls.proxy_thread.start() |
| 126 | cls.proxy_ready.wait() |
| 127 | |
| 128 | certificate = pathlib.Path(CONF_DIR) / f"{CONF_BASENAME}-ca-cert.pem" |
| 129 | certificate = certificate.expanduser() |
| 130 | cls.proxy_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 131 | cls.proxy_context.load_verify_locations(bytes(certificate)) |
| 132 | |
| 133 | def get_http_connects(self): |
| 134 | return self.proxy_master.addons.get("recordflows").get_http_connects() |