diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py index 0fb9e0268b52..f295b205a78b 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py @@ -380,6 +380,7 @@ async def _read( async def _write(self, s): """Write a string out to the SSL socket fully.""" self.writer.write(s) + await self.writer.drain() async def close(self): if self.writer is not None: @@ -387,6 +388,7 @@ async def close(self): # see issue: https://github.com/encode/httpx/issues/914 self.writer.transport.abort() self.writer.close() + await self.writer.wait_closed() self.writer, self.reader = None, None self.sock = None self.connected = False