// bug 26552
 public void testServerNamedTransientAutoDeleteQueueAndBindingRecovery()
     throws IOException, InterruptedException, TimeoutException {
   String x = "tmp-fanout";
   Channel ch = connection.createChannel();
   ch.exchangeDelete(x);
   ch.exchangeDeclare(x, "fanout");
   String q = ch.queueDeclare("", false, false, true, null).getQueue();
   final AtomicReference<String> nameBefore = new AtomicReference<String>(q);
   final AtomicReference<String> nameAfter = new AtomicReference<String>();
   final CountDownLatch listenerLatch = new CountDownLatch(1);
   ((AutorecoveringConnection) connection)
       .addQueueRecoveryListener(
           new QueueRecoveryListener() {
             @Override
             public void queueRecovered(String oldName, String newName) {
               nameBefore.set(oldName);
               nameAfter.set(newName);
               listenerLatch.countDown();
             }
           });
   ch.queueBind(nameBefore.get(), x, "");
   restartPrimaryAndWaitForRecovery();
   expectChannelRecovery(ch);
   ch.confirmSelect();
   ch.exchangeDeclare(x, "fanout");
   ch.basicPublish(x, "", null, "msg".getBytes());
   waitForConfirms(ch);
   AMQP.Queue.DeclareOk ok = ch.queueDeclarePassive(nameAfter.get());
   assertEquals(1, ok.getMessageCount());
   ch.queueDelete(nameAfter.get());
   ch.exchangeDelete(x);
 }
 public void testConnectionRecoveryWithDisabledTopologyRecovery()
     throws IOException, InterruptedException, TimeoutException {
   AutorecoveringConnection c = newRecoveringConnection(true);
   Channel ch = c.createChannel();
   String q = "java-client.test.recovery.q2";
   ch.queueDeclare(q, false, true, false, null);
   ch.queueDeclarePassive(q);
   assertTrue(c.isOpen());
   try {
     CountDownLatch shutdownLatch = prepareForShutdown(c);
     CountDownLatch recoveryLatch = prepareForRecovery(c);
     Host.closeConnection(c);
     wait(shutdownLatch);
     wait(recoveryLatch);
     assertTrue(c.isOpen());
     ch.queueDeclarePassive(q);
     fail("expected passive declaration to throw");
   } catch (java.io.IOException e) {
     // expected
   } finally {
     c.abort();
   }
 }