'BlockingConnection: Create and close connection with channel and consumer'

def test(self):

    connection = self._connect()
    ch = connection.channel()
    q_name = ('TestCreateAndCloseConnectionWithChannelAndConsumer_q' + uuid.uuid1().hex)
    body1 = ('a' * 1024)
    ch.queue_declare(q_name, auto_delete=True)
    self.addCleanup(self._connect().channel().queue_delete, q_name)
    ch.publish(exchange='', routing_key=q_name, body=body1)
    ch.basic_consume((lambda *x: None), q_name, no_ack=True, exclusive=False, arguments=None)
    connection.close()
    self.assertTrue(connection.is_closed)
    self.assertFalse(connection.is_open)
    self.assertFalse(connection.is_closing)
    self.assertFalse(connection._impl._channels)
    self.assertFalse(ch._consumer_infos)
    self.assertFalse(ch._impl._consumers)
