Verify the channel can pass some plaintext

This commit is contained in:
Alex Stokes 2019-08-24 23:26:26 +02:00
parent 737195f461
commit f08aa339b4
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086

View File

@ -49,7 +49,7 @@ class InMemoryConnection(IRawConnection):
self.current_msg = None
return next_msg
def close(self) -> None:
async def close(self) -> None:
self.closed = True
@ -88,14 +88,18 @@ async def test_create_secure_session():
local_session_builder, remote_session_builder
)
msg = b"abc"
await local_secure_conn.write(msg)
received_msg = await remote_secure_conn.read()
assert received_msg == msg
await asyncio.gather(local_secure_conn.close(), remote_secure_conn.close())
local_pipe_task.cancel()
remote_pipe_task.cancel()
await local_pipe_task
await remote_pipe_task
assert local_secure_conn
assert remote_secure_conn
if __name__ == "__main__":
asyncio.run(test_create_secure_session())