Source:
<code>public void testHardErrorAndReconnectAuto() throws Exception { RabbitTemplate template = new RabbitTemplate(connectionFactory); RabbitAdmin admin = new RabbitAdmin(connectionFactory); Queue queue = new Queue(CF_INTEGRATION_TEST_QUEUE); admin.declareQueue(queue); final String route = queue.getName(); final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch recoveryLatch = new CountDownLatch(1); final RecoveryListener listener = new RecoveryListener() { @Override public void handleRecoveryStarted(Recoverable recoverable) { } @Override public void handleRecovery(Recoverable recoverable) { try { ((Channel) recoverable).basicCancel("testHardErrorAndReconnect"); } catch (IOException e) { } recoveryLatch.countDown(); } }; try { template.execute(channel -> { channel.getConnection().addShutdownListener(cause -> { logger.info("Error", cause); latch.countDown(); throw new RuntimeException(cause); }); Channel targetChannel = ((ChannelProxy) channel).getTargetChannel(); if (targetChannel instanceof AutorecoveringChannel) { ((AutorecoveringChannel) targetChannel).addRecoveryListener(listener); } else { <START> recoveryLatch.countDown(); <END> } String tag = channel.basicConsume(route, false, "testHardErrorAndReconnect", new DefaultConsumer(channel)); String result = channel.basicConsume(route, false, tag, new DefaultConsumer(channel)); fail("Expected IOException, got: " + result); return null; }); fail("Expected AmqpIOException"); } catch (AmqpException e) { } assertTrue(recoveryLatch.await(10, TimeUnit.SECONDS)); template.convertAndSend(route, "message"); assertTrue(latch.await(10, TimeUnit.SECONDS)); String result = (String) template.receiveAndConvert(route); assertEquals("message", result); result = (String) template.receiveAndConvert(route); assertEquals(null, result); }</code><technical_language>Is some case jump this else block? Thanks</technical_language>

Target:
public void testHardErrorAndReconnectAuto() throws Exception { RabbitTemplate template = new RabbitTemplate(connectionFactory); RabbitAdmin admin = new RabbitAdmin(connectionFactory); Queue queue = new Queue(CF_INTEGRATION_TEST_QUEUE); admin.declareQueue(queue); final String route = queue.getName(); final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch recoveryLatch = new CountDownLatch(1); final RecoveryListener listener = new RecoveryListener() { @Override public void handleRecoveryStarted(Recoverable recoverable) { } @Override public void handleRecovery(Recoverable recoverable) { try { ((Channel) recoverable).basicCancel("testHardErrorAndReconnect"); } catch (IOException e) { } recoveryLatch.countDown(); } }; try { template.execute(channel -> { channel.getConnection().addShutdownListener(cause -> { logger.info("Error", cause); latch.countDown(); throw new RuntimeException(cause); }); Channel targetChannel = ((ChannelProxy) channel).getTargetChannel(); if (targetChannel instanceof AutorecoveringChannel) { ((AutorecoveringChannel) targetChannel).addRecoveryListener(listener); } else { fail("Expected an AutorecoveringChannel"); } String tag = channel.basicConsume(route, false, "testHardErrorAndReconnect", new DefaultConsumer(channel)); String result = channel.basicConsume(route, false, tag, new DefaultConsumer(channel)); fail("Expected IOException, got: " + result); return null; }); fail("Expected AmqpIOException"); } catch (AmqpException e) { } assertTrue(recoveryLatch.await(10, TimeUnit.SECONDS)); template.convertAndSend(route, "message"); assertTrue(latch.await(10, TimeUnit.SECONDS)); String result = (String) template.receiveAndConvert(route); assertEquals("message", result); result = (String) template.receiveAndConvert(route); assertEquals(null, result); }