(self)
| 35 | self._socket.close() |
| 36 | |
| 37 | def _process(self): |
| 38 | while self._done is False: |
| 39 | try: |
| 40 | c, client_address = self._socket.accept() |
| 41 | try: |
| 42 | data = c.recv(16) |
| 43 | c.sendall("""HTTP/1.1 200 Ok |
| 44 | Server: UdsFaker |
| 45 | Content-Type: application/json |
| 46 | Content-Length: 19 |
| 47 | |
| 48 | { "host": "faked" }""".encode()) |
| 49 | finally: |
| 50 | c.close() |
| 51 | |
| 52 | except ConnectionAbortedError: |
| 53 | self._done = True |
| 54 | |
| 55 | |
| 56 | class TestProxyUds: |