Improved compatibility with socket API to make copas work with socket.http async requests