(self, server_cls)
| 1105 | class WaitForHandshakeTest(AsyncTestCase): |
| 1106 | @gen.coroutine |
| 1107 | def connect_to_server(self, server_cls): |
| 1108 | server = client = None |
| 1109 | try: |
| 1110 | sock, port = bind_unused_port() |
| 1111 | server = server_cls(ssl_options=_server_ssl_options()) |
| 1112 | server.add_socket(sock) |
| 1113 | |
| 1114 | ssl_ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) |
| 1115 | ssl_ctx.check_hostname = False |
| 1116 | ssl_ctx.verify_mode = ssl.CERT_NONE |
| 1117 | # These tests fail with ConnectionAbortedErrors with TLS |
| 1118 | # 1.3 on windows python 3.7.4 (which includes an upgrade |
| 1119 | # to openssl 1.1.c. Other platforms might be affected with |
| 1120 | # newer openssl too). Disable it until we figure out |
| 1121 | # what's up. |
| 1122 | # Update 2021-12-28: Still happening with Python 3.10 on |
| 1123 | # Windows. OP_NO_TLSv1_3 now raises a DeprecationWarning. |
| 1124 | with ignore_deprecation(): |
| 1125 | ssl_ctx.options |= getattr(ssl, "OP_NO_TLSv1_3", 0) |
| 1126 | client = SSLIOStream(socket.socket(), ssl_options=ssl_ctx) |
| 1127 | yield client.connect(("127.0.0.1", port)) |
| 1128 | self.assertIsNotNone(client.socket.cipher()) |
| 1129 | finally: |
| 1130 | if server is not None: |
| 1131 | server.stop() |
| 1132 | if client is not None: |
| 1133 | client.close() |
| 1134 | |
| 1135 | @gen_test |
| 1136 | def test_wait_for_handshake_future(self): |
no test coverage detected