// requeue=false. So we can't really test any scenarios for
// requeue=false.
void verifyRedeliverOnRecover(RecoverCallback call)
throws IOException, InterruptedException {
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queue, false, consumer); // require acks.
channel.basicPublish("", queue, new AMQP.BasicProperties.Builder().build(), body);
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
assertTrue("consumed message body not as sent",
Arrays.equals(body, delivery.getBody()));
// Don't ack it, and get it redelivered to the same consumer
call.recover(channel);
QueueingConsumer.Delivery secondDelivery = consumer.nextDelivery(5000);
assertNotNull("timed out waiting for redelivered message", secondDelivery);
assertTrue("consumed (redelivered) message body not as sent",
Arrays.equals(body, delivery.getBody()));
}