This API does not control the connection. This API does no direct IO at all. Something like Twisted or asyncio or the "ssl" module in Python would glue this API with a particular IO implementation and do things like closing connections.