async def main(): from trio.testing import memory_stream_pair server_raw_stream, client_raw_stream = memory_stream_pair() async with trio.open_nursery() as nursery: nursery.start_soon(demo_server, server_raw_stream) nursery.start_soon(demo_client, client_raw_stream)
async def connect(self): assert not self.closed client, server = memory_stream_pair() await self.queued_streams.put(server) return client
async def connect(self): assert not self.closed client, server = memory_stream_pair() await self.queued_streams[0].send(server) return client