@asyncio.coroutine<EOL><INDENT>def close(self):<DEDENT>
if not self.is_closed():<EOL><INDENT>self._closing = True<EOL>self.sender.send_Close(<EOL><NUM_LIT:0>, '<STR_LIT>', <NUM_LIT:0>, <NUM_LIT:0>)<EOL>try:<EOL><INDENT>yield from self.synchroniser.wait(spec.ConnectionCloseOK)<EOL><DEDENT>except AMQPConnectionError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if self._closing:<EOL><INDENT>log.warn("<STR_LIT>")<EOL><DEDENT><DEDENT>yield from self.protocol.heartbeat_monitor.wait_closed()<EOL>
Close the connection by handshaking with the server.

This method is a :ref:`coroutine <coroutine>`.