def METHOD_NAME(self):
    # handle_stream may be a native coroutine.
    class TestServer(TCPServer):
        async def handle_stream(self, stream, address):
            stream.write(b"data")
            stream.close()
    sock, port = bind_unused_port()
    server = TestServer()
    server.add_socket(sock)
    client = IOStream(socket.socket())
    yield client.connect(("localhost", port))
    result = yield client.read_until_close()
    self.assertEqual(result, b"data")
    server.stop()
    client.close()