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

Method client_sock

Lib/test/test_asyncio/test_ssl.py:341–361  ·  view source on GitHub ↗
(addr)

Source from the content-addressed store, hash-verified

339 await self.wait_closed(writer)
340
341 async def client_sock(addr):
342 sock = socket.socket()
343 sock.connect(addr)
344 reader, writer = await asyncio.open_connection(
345 sock=sock,
346 ssl=client_sslctx,
347 server_hostname='',
348 ssl_handshake_timeout=HANDSHAKE_TIMEOUT)
349
350 writer.write(A_DATA)
351 self.assertEqual(await reader.readexactly(2), b'OK')
352
353 writer.write(B_DATA)
354 self.assertEqual(await reader.readexactly(4), b'SPAM')
355
356 nonlocal CNT
357 CNT += 1
358
359 writer.close()
360 await self.wait_closed(writer)
361 sock.close()
362
363 def run(coro):
364 nonlocal CNT

Callers

nothing calls this directly

Calls 7

wait_closedMethod · 0.95
socketMethod · 0.80
readexactlyMethod · 0.80
connectMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected