(reader, writer)
| 446 | """Client closes the connection when receiving non-HTTP response from server.""" |
| 447 | |
| 448 | async def junk(reader, writer): |
| 449 | await asyncio.sleep(MS) # wait for the client to send the handshake request |
| 450 | writer.write(b"220 smtp.invalid ESMTP Postfix\r\n") |
| 451 | await reader.read(4096) # wait for the client to close the connection |
| 452 | writer.close() |
| 453 | |
| 454 | server = await asyncio.start_server(junk, "localhost", 0) |
| 455 | host, port = get_host_port(server) |