Java Code Examples for javax.jms.InvalidDestinationException

The following examples show how to use javax.jms.InvalidDestinationException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: qpid-jms   Source File: JmsDurableSubscriberTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 60000)
public void testDurableSubscriptionUnsubscribeNoExistingSubThrowsJMSEx() throws Exception {
    connection = createAmqpConnection();
    connection.setClientID("DURABLE-AMQP");
    connection.start();

    assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length);
    assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length);

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    assertNotNull(session);

    BrokerViewMBean broker = getProxyToBroker();
    assertEquals(0, broker.getDurableTopicSubscribers().length);
    assertEquals(0, broker.getInactiveDurableTopicSubscribers().length);

    try {
        session.unsubscribe(getSubscriptionName());
        fail("Should have thrown an InvalidDestinationException");
    } catch (InvalidDestinationException ide) {
    }
}
 
Example 2
Source Project: qpid-broker-j   Source File: QueueSenderTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void anonymousSenderSendToUnknownQueue() throws Exception
{
    QueueConnection connection = ((QueueConnection) getConnectionBuilder().setSyncPublish(true).build());

    try
    {
        QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue invalidDestination = session.createQueue("unknown");

        try
        {
            QueueSender sender = session.createSender(null);
            sender.send(invalidDestination, session.createMessage());
            fail("Exception not thrown");
        }
        catch (InvalidDestinationException e)
        {
            //PASS
        }
    }
    finally
    {
        connection.close();
    }
}
 
Example 3
@Test
public void testFQQNTopicWhenQueueDoesNotExist() throws Exception {
   Exception e = null;
   String queueName = "testQueue";

   Connection connection = createConnection(false);
   try {
      connection.setClientID("FQQNconn");
      connection.start();
      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = session.createTopic(multicastAddress.toString() + "::" + queueName);
      session.createConsumer(topic);
   } catch (InvalidDestinationException ide) {
      e = ide;
   } finally {
      connection.close();
   }
   assertNotNull(e);
   assertTrue(e.getMessage().contains("Queue: '" + queueName + "' does not exist"));
}
 
Example 4
/**
 * Broker should return exception if no address is passed in FQQN.
 * @throws Exception
 */
@Test
public void testQueueSpecial() throws Exception {
   server.createQueue(new QueueConfiguration(anycastQ1).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST));

   Connection connection = createConnection();
   Exception expectedException = null;
   try {
      connection.start();
      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

      //::queue ok!
      String specialName = CompositeAddress.toFullyQualified(new SimpleString(""), anycastQ1).toString();
      javax.jms.Queue q1 = session.createQueue(specialName);
      session.createConsumer(q1);
   } catch (InvalidDestinationException e) {
      expectedException = e;
   }
   assertNotNull(expectedException);
   assertTrue(expectedException.getMessage().contains("Queue: 'q1' does not exist for address ''"));
}
 
Example 5
Source Project: activemq-artemis   Source File: MessageConsumerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConsumerOnNonExistentTopic() throws Exception {
   Connection pconn = null;

   try {
      pconn = createConnection();

      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      try {
         ps.createConsumer(new Topic() {
            @Override
            public String getTopicName() throws JMSException {
               return "NoSuchTopic";
            }
         });
         ProxyAssertSupport.fail("should throw exception");
      } catch (InvalidDestinationException e) {
         // OK
      }
   } finally {
      if (pconn != null) {
         pconn.close();
      }
   }
}
 
Example 6
Source Project: activemq-artemis   Source File: MessageConsumerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConsumerOnNonExistentQueue() throws Exception {
   Connection pconn = null;

   try {
      pconn = createConnection();

      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      try {
         ps.createConsumer(new Queue() {
            @Override
            public String getQueueName() throws JMSException {
               return "NoSuchQueue";
            }
         });
         ProxyAssertSupport.fail("should throw exception");
      } catch (InvalidDestinationException e) {
         // OK
      }
   } finally {
      if (pconn != null) {
         pconn.close();
      }
   }
}
 
Example 7
Source Project: activemq-artemis   Source File: DurableSubscriptionTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testDurableSubscriptionOnTemporaryTopic() throws Exception {
   Connection conn = null;

   conn = createConnection();

   try {
      conn.setClientID("doesn't actually matter");
      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic temporaryTopic = s.createTemporaryTopic();

      try {
         s.createDurableSubscriber(temporaryTopic, "mySubscription");
         ProxyAssertSupport.fail("this should throw exception");
      } catch (InvalidDestinationException e) {
         // OK
      }
   } finally {
      if (conn != null) {
         conn.close();
      }
   }
}
 
Example 8
Source Project: activemq-artemis   Source File: MessageProducerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateProducerOnInexistentDestination() throws Exception {
   getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false));
   getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false));
   Connection pconn = createConnection();
   try {
      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      try {
         ps.createProducer(ActiveMQJMSClient.createTopic("NoSuchTopic"));
         ProxyAssertSupport.fail("should throw exception");
      } catch (InvalidDestinationException e) {
         // OK
      }
   } finally {
      pconn.close();
   }
}
 
Example 9
Source Project: activemq-artemis   Source File: BrowserTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateBrowserOnNonExistentQueue() throws Exception {
   Connection pconn = getConnectionFactory().createConnection();

   try {
      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      try {
         ps.createBrowser(new Queue() {
            @Override
            public String getQueueName() throws JMSException {
               return "NoSuchQueue";
            }
         });
         ProxyAssertSupport.fail("should throw exception");
      } catch (InvalidDestinationException e) {
         // OK
      }
   } finally {
      if (pconn != null) {
         pconn.close();
      }
   }
}
 
Example 10
Source Project: cougar   Source File: JmsEventTransportImpl.java    License: Apache License 2.0 6 votes vote down vote up
private Destination createDestination(Session session, String destinationName) throws JMSException {
    try {
        Destination destination = null;
        switch (destinationType) {
            case DurableTopic:
            case Topic:
                destination = session.createTopic(destinationName);
                break;
            case Queue:
                destination = session.createQueue(destinationName);
                break;
        }
        return destination;
    }
    catch (InvalidDestinationException ide) {
        throw new CougarFrameworkException("Error creating "+destinationType+" for destination name '"+destinationName+"'",ide);
    }
}
 
Example 11
Source Project: qpid-jms   Source File: JmsTemporaryTopicTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 60000)
public void testCantConsumeFromTemporaryTopicCreatedOnAnotherConnection() throws Exception {
    connection = createAmqpConnection();
    connection.start();

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    TemporaryTopic tempTopic = session.createTemporaryTopic();
    session.createConsumer(tempTopic);

    Connection connection2 = createAmqpConnection();
    try {
        Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            session2.createConsumer(tempTopic);
            fail("should not be able to consumer from temporary topic from another connection");
        } catch (InvalidDestinationException ide) {
            // expected
        }
    } finally {
        connection2.close();
    }
}
 
Example 12
Source Project: activemq-artemis   Source File: ActiveMQMessage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setJMSReplyTo(final Destination dest) throws JMSException {

   if (dest == null) {
      MessageUtil.setJMSReplyTo(message, (String) null);
      replyTo = null;
   } else {
      if (dest instanceof ActiveMQDestination == false) {
         throw new InvalidDestinationException("Foreign destination " + dest);
      }

      String prefix = prefixOf(dest);
      ActiveMQDestination jbd = (ActiveMQDestination) dest;

      MessageUtil.setJMSReplyTo(message, prefix + jbd.getAddress());

      replyTo = jbd;
   }
}
 
Example 13
Source Project: qpid-jms   Source File: JmsTemporaryQueueTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 60000)
public void testCantConsumeFromTemporaryQueueCreatedOnAnotherConnection() throws Exception {
    connection = createAmqpConnection();
    connection.start();

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    TemporaryQueue tempQueue = session.createTemporaryQueue();
    session.createConsumer(tempQueue);

    Connection connection2 = createAmqpConnection();
    try {
        Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            session2.createConsumer(tempQueue);
            fail("should not be able to consumer from temporary queue from another connection");
        } catch (InvalidDestinationException ide) {
            // expected
        }
    } finally {
        connection2.close();
    }
}
 
Example 14
Source Project: activemq-artemis   Source File: ActiveMQSession.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public TopicSubscriber createDurableSubscriber(final Topic topic,
                                               final String name,
                                               String messageSelector,
                                               final boolean noLocal) throws JMSException {
   // As per spec. section 4.11
   if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) {
      throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
   }
   checkTopic(topic);
   if (!(topic instanceof ActiveMQDestination)) {
      throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic);
   }
   if ("".equals(messageSelector)) {
      messageSelector = null;
   }

   ActiveMQDestination jbdest = (ActiveMQDestination) topic;

   if (jbdest.isQueue()) {
      throw new InvalidDestinationException("Cannot create a subscriber on a queue");
   }

   return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE);
}
 
Example 15
Source Project: activemq-artemis   Source File: ActiveMQSession.java    License: Apache License 2.0 6 votes vote down vote up
public void deleteTemporaryQueue(final ActiveMQDestination tempQueue) throws JMSException {
   if (!tempQueue.isTemporary()) {
      throw new InvalidDestinationException("Not a temporary queue " + tempQueue);
   }
   try {
      QueueQuery response = session.queueQuery(tempQueue.getSimpleAddress());

      if (!response.isExists()) {
         throw new InvalidDestinationException("Cannot delete temporary queue " + tempQueue.getName() +
                                                  " does not exist");
      }

      if (response.getConsumerCount() > 0) {
         throw new IllegalStateException("Cannot delete temporary queue " + tempQueue.getName() +
                                            " since it has subscribers");
      }

      SimpleString address = tempQueue.getSimpleAddress();

      session.deleteQueue(address);

      connection.removeTemporaryQueue(address);
   } catch (ActiveMQException e) {
      throw JMSExceptionHelper.convertFromActiveMQException(e);
   }
}
 
Example 16
static Destination setCompatibleReplyTo(Destination dest, ClientMessage message) throws InvalidDestinationException {
   if (dest == null) {
      MessageUtil.setJMSReplyTo(message, (String) null);
      return null;
   } else {
      if (dest instanceof ActiveMQDestination == false) {
         throw new InvalidDestinationException("Foreign destination " + dest);
      }
      ActiveMQDestination jbd = (ActiveMQDestination) dest;
      final String address = jbd.getAddress();
      if (hasPrefix1X(address)) {
         MessageUtil.setJMSReplyTo(message, jbd.getAddress());
      } else {
         String prefix = prefixOf(dest);
         MessageUtil.setJMSReplyTo(message, prefix + jbd.getAddress());
      }
      return jbd;
   }
}
 
Example 17
Source Project: qpid-jms   Source File: JmsSession.java    License: Apache License 2.0 6 votes vote down vote up
protected void send(JmsMessageProducer producer, Destination dest, Message msg, int deliveryMode, int priority, long timeToLive, boolean disableMsgId, boolean disableTimestamp, long deliveryDelay, CompletionListener listener) throws JMSException {
    if (dest == null) {
        throw new InvalidDestinationException("Destination must not be null");
    }

    if (msg == null) {
        throw new MessageFormatException("Message must not be null");
    }

    JmsDestination destination = JmsMessageTransformation.transformDestination(connection, dest);

    if (destination.isTemporary() && ((JmsTemporaryDestination) destination).isDeleted()) {
        throw new IllegalStateException("Temporary destination has been deleted");
    }

    send(producer, destination, msg, deliveryMode, priority, timeToLive, disableMsgId, disableTimestamp, deliveryDelay, listener);
}
 
Example 18
Source Project: qpid-jms   Source File: JmsTopicPublisherTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 10000)
public void testPublishMessageOnProvidedTopicWhenNotAnonymous() throws Exception {
    Topic topic = session.createTopic(getTestName());
    TopicPublisher publisher = session.createPublisher(topic);
    Message message = session.createMessage();

    try {
        publisher.publish(session.createTopic(getTestName() + "1"), message);
        fail("Should throw UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {}

    try {
        publisher.publish((Topic) null, message);
        fail("Should throw InvalidDestinationException");
    } catch (InvalidDestinationException ide) {}
}
 
Example 19
Source Project: qpid-jms   Source File: JmsTopicPublisherTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 10000)
public void testPublishMessageWithOptionsOnProvidedTopicWhenNotAnonymous() throws Exception {
    Topic topic = session.createTopic(getTestName());
    TopicPublisher publisher = session.createPublisher(topic);
    Message message = session.createMessage();

    try {
        publisher.publish(session.createTopic(getTestName() + "1"), message, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
        fail("Should throw UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {}

    try {
        publisher.publish((Topic) null, message, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
        fail("Should throw InvalidDestinationException");
    } catch (InvalidDestinationException ide) {}
}
 
Example 20
Source Project: qpid-jms   Source File: FailedConnectionsIntegrationTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 20000)
public void testConnectWithNotFoundErrorThrowsJMSEWhenInvalidContainerHintNotPresent() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        testPeer.rejectConnect(AmqpError.NOT_FOUND, "Virtual Host does not exist", null);
        try {
            establishAnonymousConnecton(testPeer, true);
            fail("Should have thrown JMSException");
        } catch (InvalidDestinationException destEx) {
            fail("Should not convert to destination exception for this case.");
        } catch (JMSException jmsEx) {
            LOG.info("Caught expected Exception: {}", jmsEx.getMessage(), jmsEx);
            // Expected
        } catch (Exception ex) {
            fail("Should have thrown JMSException: " + ex);
        }

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
Example 21
Source Project: spring-analysis-note   Source File: MessageListenerAdapterTests.java    License: MIT License 5 votes vote down vote up
@Test
public void testWithResponsiveMessageDelegateNoDefaultDestinationAndNoReplyToDestination_SendsReturnTextMessageWhenSessionSupplied() throws Exception {
	final TextMessage sentTextMessage = mock(TextMessage.class);
	// correlation ID is queried when response is being created...
	given(sentTextMessage.getJMSCorrelationID()).willReturn(CORRELATION_ID);
	// Reply-To is queried when response is being created...
	given(sentTextMessage.getJMSReplyTo()).willReturn(null);

	TextMessage responseTextMessage = mock(TextMessage.class);
	final QueueSession session = mock(QueueSession.class);
	given(session.createTextMessage(RESPONSE_TEXT)).willReturn(responseTextMessage);

	ResponsiveMessageDelegate delegate = mock(ResponsiveMessageDelegate.class);
	given(delegate.handleMessage(sentTextMessage)).willReturn(RESPONSE_TEXT);

	final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
		@Override
		protected Object extractMessage(Message message) {
			return message;
		}
	};
	try {
		adapter.onMessage(sentTextMessage, session);
		fail("expected CouldNotSendReplyException with InvalidDestinationException");
	}
	catch (ReplyFailureException ex) {
		assertEquals(InvalidDestinationException.class, ex.getCause().getClass());
	}

	verify(responseTextMessage).setJMSCorrelationID(CORRELATION_ID);
	verify(delegate).handleMessage(sentTextMessage);
}
 
Example 22
@Test
public void emptySendTo() throws JMSException {
	MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);

	TextMessage reply = mock(TextMessage.class);
	Session session = mock(Session.class);
	given(session.createTextMessage("content")).willReturn(reply);

	assertThatExceptionOfType(ReplyFailureException.class).isThrownBy(() ->
			listener.onMessage(createSimpleJmsTextMessage("content"), session))
		.withCauseInstanceOf(InvalidDestinationException.class);
}
 
Example 23
@Test
public void testWithResponsiveMessageDelegateNoDefaultDestinationAndNoReplyToDestination_SendsReturnTextMessageWhenSessionSupplied() throws Exception {
	final TextMessage sentTextMessage = mock(TextMessage.class);
	// correlation ID is queried when response is being created...
	given(sentTextMessage.getJMSCorrelationID()).willReturn(CORRELATION_ID);
	// Reply-To is queried when response is being created...
	given(sentTextMessage.getJMSReplyTo()).willReturn(null);

	TextMessage responseTextMessage = mock(TextMessage.class);
	final QueueSession session = mock(QueueSession.class);
	given(session.createTextMessage(RESPONSE_TEXT)).willReturn(responseTextMessage);

	ResponsiveMessageDelegate delegate = mock(ResponsiveMessageDelegate.class);
	given(delegate.handleMessage(sentTextMessage)).willReturn(RESPONSE_TEXT);

	final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
		@Override
		protected Object extractMessage(Message message) {
			return message;
		}
	};
	try {
		adapter.onMessage(sentTextMessage, session);
		fail("expected CouldNotSendReplyException with InvalidDestinationException");
	}
	catch (ReplyFailureException ex) {
		assertEquals(InvalidDestinationException.class, ex.getCause().getClass());
	}

	verify(responseTextMessage).setJMSCorrelationID(CORRELATION_ID);
	verify(delegate).handleMessage(sentTextMessage);
}
 
Example 24
@Test
public void emptySendTo() throws JMSException {
	MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);

	TextMessage reply = mock(TextMessage.class);
	Session session = mock(Session.class);
	given(session.createTextMessage("content")).willReturn(reply);

	this.thrown.expect(ReplyFailureException.class);
	this.thrown.expectCause(Matchers.isA(InvalidDestinationException.class));
	listener.onMessage(createSimpleJmsTextMessage("content"), session);
}
 
Example 25
Source Project: pooled-jms   Source File: JmsPoolMessageProducerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testNullDestinationOnSendToAnonymousProducer() throws JMSException {
    JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection();
    Session session = connection.createSession();
    MessageProducer producer = session.createProducer(null);

    try {
        producer.send(null, session.createMessage());
        fail("Should not be able to send with null destination");
    } catch (InvalidDestinationException ide) {}
}
 
Example 26
Source Project: pooled-jms   Source File: JmsPoolMessageProducerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testNullDestinationOnSendToTargetedProducer() throws JMSException {
    JmsPoolConnection connection = (JmsPoolConnection) cf.createQueueConnection();
    Session session = connection.createSession();
    MessageProducer producer = session.createProducer(session.createTemporaryQueue());

    try {
        producer.send(null, session.createMessage());
        fail("Should not be able to send with null destination");
    } catch (InvalidDestinationException ide) {}
}
 
Example 27
Source Project: qpid-jms   Source File: JmsSessionTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(timeout = 10000)
public void testCannotCreateConsumerOnTempDestinationFromSomeOtherSource() throws JMSException {
    JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    TemporaryQueue tempQueue = new JmsTemporaryQueue("ID:" + UUID.randomUUID().toString());

    try {
        session.createConsumer(tempQueue);
        fail("Should not be able to create a consumer");
    } catch (InvalidDestinationException idex) {}
}
 
Example 28
Source Project: dubbox   Source File: JmsQueueRequestor.java    License: Apache License 2.0 5 votes vote down vote up
public JmsQueueRequestor(QueueSession session, Queue queue) throws JMSException {
	super();

	if (queue == null) {
		throw new InvalidDestinationException("Invalid queue");
	}

	setSession(session);
	setTemporaryQueue(session.createTemporaryQueue());
	setSender(session.createSender(queue));
	setReceiver(session.createReceiver(getTemporaryQueue()));
}
 
Example 29
Source Project: qpid-broker-j   Source File: QueueSenderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void sendToUnknownQueue() throws Exception
{
    QueueConnection connection = ((QueueConnection) getConnectionBuilder().build());

    try
    {
        QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue invalidDestination = session.createQueue("unknown");

        try
        {
            QueueSender sender = session.createSender(invalidDestination);
            sender.send(session.createMessage());
            fail("Exception not thrown");
        }
        catch (InvalidDestinationException e)
        {
            //PASS
        }
    }
    finally
    {
        connection.close();
    }
}
 
Example 30
@Test
public void testWithResponsiveMessageDelegateNoDefaultDestinationAndNoReplyToDestination_SendsReturnTextMessageWhenSessionSupplied() throws Exception {
	final TextMessage sentTextMessage = mock(TextMessage.class);
	// correlation ID is queried when response is being created...
	given(sentTextMessage.getJMSCorrelationID()).willReturn(CORRELATION_ID);
	// Reply-To is queried when response is being created...
	given(sentTextMessage.getJMSReplyTo()).willReturn(null);

	TextMessage responseTextMessage = mock(TextMessage.class);
	final QueueSession session = mock(QueueSession.class);
	given(session.createTextMessage(RESPONSE_TEXT)).willReturn(responseTextMessage);

	ResponsiveMessageDelegate delegate = mock(ResponsiveMessageDelegate.class);
	given(delegate.handleMessage(sentTextMessage)).willReturn(RESPONSE_TEXT);

	final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
		@Override
		protected Object extractMessage(Message message) {
			return message;
		}
	};
	try {
		adapter.onMessage(sentTextMessage, session);
		fail("expected CouldNotSendReplyException with InvalidDestinationException");
	} catch(ReplyFailureException ex) {
		assertEquals(InvalidDestinationException.class, ex.getCause().getClass());
	}

	verify(responseTextMessage).setJMSCorrelationID(CORRELATION_ID);
	verify(delegate).handleMessage(sentTextMessage);
}