diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java index 95380d5d..4e9e3d13 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java @@ -51,6 +51,18 @@ public class CachingConnectionFactoryIntegrationTests { } + @Test + public void testReceiveFromNonExistentVirtualHost() throws Exception { + + connectionFactory.setVirtualHost("non-existent"); + RabbitTemplate template = new RabbitTemplate(connectionFactory); + // Wrong vhost is very unfriendly to client - the exception has no clue (just an EOF) + exception.expect(AmqpIOException.class); + String result = (String) template.receiveAndConvert("foo"); + assertEquals("message", result); + + } + @Test public void testSendAndReceiveFromVolatileQueueAfterImplicitRemoval() throws Exception {