| 440 | sock.close() |
| 441 | |
| 442 | class ClientProtoFirst(asyncio.BufferedProtocol): |
| 443 | def __init__(self, on_data): |
| 444 | self.on_data = on_data |
| 445 | self.buf = bytearray(1) |
| 446 | |
| 447 | def connection_made(self, tr): |
| 448 | nonlocal client_con_made_calls |
| 449 | client_con_made_calls += 1 |
| 450 | |
| 451 | def get_buffer(self, sizehint): |
| 452 | return self.buf |
| 453 | |
| 454 | def buffer_updated(slf, nsize): |
| 455 | self.assertEqual(nsize, 1) |
| 456 | slf.on_data.set_result(bytes(slf.buf[:nsize])) |
| 457 | |
| 458 | class ClientProtoSecond(asyncio.Protocol): |
| 459 | def __init__(self, on_data, on_eof): |