| 830 | sock.close() |
| 831 | |
| 832 | class ClientProtoFirst(asyncio.BufferedProtocol): |
| 833 | def __init__(self, on_data): |
| 834 | self.on_data = on_data |
| 835 | self.buf = bytearray(1) |
| 836 | |
| 837 | def connection_made(self, tr): |
| 838 | nonlocal client_con_made_calls |
| 839 | client_con_made_calls += 1 |
| 840 | |
| 841 | def get_buffer(self, sizehint): |
| 842 | return self.buf |
| 843 | |
| 844 | def buffer_updated(self, nsize): |
| 845 | assert nsize == 1 |
| 846 | self.on_data.set_result(bytes(self.buf[:nsize])) |
| 847 | |
| 848 | def eof_received(self): |
| 849 | pass |
| 850 | |
| 851 | class ClientProtoSecond(asyncio.Protocol): |
| 852 | def __init__(self, on_data, on_eof): |