async def connect(self):
        """与远端建立连接.

        主要执行的操作有:
        + 将监听响应的协程_response_handler放入事件循环
        + 如果有验证信息则发送验证信息
        + 获取连接建立的返回

        """
        self.reader, self.writer = await asyncio.open_connection(
            host=self.hostname,
            port=self.port,
            loop=self.loop)
        self.closed = False
        self._response_task = asyncio.ensure_future(self._response_handler())
        query = {
            "MPRPC": self.VERSION,
            "AUTH": {
                "USERNAME": self.username,
                "PASSWORD": self.password
            }
        }
        queryb = self.encoder(query)
        if self.debug is True:
            print("send auth {}".format(queryb))
        self.writer.write(queryb)
        self._login_fut = self.loop.create_future()
        self.remote_info = await self._login_fut
        if self.remote_info is False:
            raise abort(501)
        if self.heart_beat:
            self._heartbeat_task = asyncio.ensure_future(
                self._heartbeat_callback())