When using StreamWriter.start_tls() (or loop.start_tls()) to upgrade a connection to TLS mid-stream, any data already buffered in the StreamReader is lost, and the call hangs forever.
The problem is present in asyncio too: python/cpython#142352 , and a solution has been provided: python/cpython#142354