(self, seconds)
| 86 | return self.conn.sock.recv(1024) |
| 87 | |
| 88 | def expect_timeout(self, seconds): |
| 89 | # Wait for response, but expect a timeout disconnection |
| 90 | start = time.time() |
| 91 | response1 = self.recv_raw() |
| 92 | stop = time.time() |
| 93 | # Server disconnected with EOF |
| 94 | assert_equal(response1, b"") |
| 95 | # Server disconnected within an acceptable range of time: |
| 96 | # not immediately, and not too far over the configured duration. |
| 97 | # This allows for some jitter in the test between client and server. |
| 98 | duration = stop - start |
| 99 | assert duration <= seconds + 2, f"Server disconnected too slow: {duration} > {seconds}" |
| 100 | assert duration >= seconds - 1, f"Server disconnected too fast: {duration} < {seconds}" |
| 101 | # The connection is definitely closed. |
| 102 | assert self.sock_closed() |
| 103 | |
| 104 | class HTTPBasicsTest (BitcoinTestFramework): |
| 105 | def set_test_params(self): |
no test coverage detected