Merge pull request #277 from ralexstokes/add-io-abstractions

Introduces IO abstractions and classes for `msgio` IO
This commit is contained in:
Alex Stokes
2019-09-04 19:11:50 +02:00
committed by GitHub
7 changed files with 156 additions and 32 deletions

View File

@ -20,11 +20,12 @@ class InMemoryConnection(IRawConnection):
self.closed = False
async def write(self, data: bytes) -> None:
async def write(self, data: bytes) -> int:
if self.closed:
raise Exception("InMemoryConnection is closed for writing")
await self.send_queue.put(data)
return len(data)
async def read(self, n: int = -1) -> bytes:
"""