def close(self):
        """Close the connection."""
        if self._transport is None:
            return
        self._transport.close()
        self._transport._closed.wait()
        self._transport = None
        self._protocol = None