MCPcopy Index your code
hub / github.com/python/cpython / test_non_blocking_handshake

Method test_non_blocking_handshake

Lib/test/test_ssl.py:2239–2258  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2237 self.assertEqual(e.exception.errno, errno.EBADF)
2238
2239 def test_non_blocking_handshake(self):
2240 s = socket.socket(socket.AF_INET)
2241 s.connect(self.server_addr)
2242 s.setblocking(False)
2243 s = test_wrap_socket(s,
2244 cert_reqs=ssl.CERT_NONE,
2245 do_handshake_on_connect=False)
2246 self.addCleanup(s.close)
2247 count = 0
2248 while True:
2249 try:
2250 count += 1
2251 s.do_handshake()
2252 break
2253 except ssl.SSLWantReadError:
2254 select.select([s], [], [])
2255 except ssl.SSLWantWriteError:
2256 select.select([], [s], [])
2257 if support.verbose:
2258 sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count)
2259
2260 def test_get_server_certificate(self):
2261 _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)

Callers

nothing calls this directly

Calls 8

test_wrap_socketFunction · 0.85
socketMethod · 0.80
addCleanupMethod · 0.80
connectMethod · 0.45
setblockingMethod · 0.45
do_handshakeMethod · 0.45
selectMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected