@Test
  public void simpleMessageListener() {
    ConfigurableApplicationContext context =
        new AnnotationConfigApplicationContext(Config.class, SimpleMessageListenerTestBean.class);

    JmsListenerContainerTestFactory factory =
        context.getBean(JmsListenerContainerTestFactory.class);
    assertEquals(
        "One container should have been registered", 1, factory.getListenerContainers().size());
    MessageListenerTestContainer container = factory.getListenerContainers().get(0);

    JmsListenerEndpoint endpoint = container.getEndpoint();
    assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass());
    MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
    assertNotNull(methodEndpoint.getBean());
    assertNotNull(methodEndpoint.getMethod());

    SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
    methodEndpoint.setupListenerContainer(listenerContainer);
    assertNotNull(listenerContainer.getMessageListener());

    assertTrue("Should have been started " + container, container.isStarted());
    context.close(); // Close and stop the listeners
    assertTrue("Should have been stopped " + container, container.isStopped());
  }
 @Test
 public void sendToAnnotationFoundOnProxy() {
   ConfigurableApplicationContext context =
       new AnnotationConfigApplicationContext(
           Config.class, ProxyConfig.class, ProxyTestBean.class);
   try {
     JmsListenerContainerTestFactory factory =
         context.getBean(JmsListenerContainerTestFactory.class);
     assertEquals(
         "one container should have been registered", 1, factory.getListenerContainers().size());
     JmsListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint();
     Method m = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination");
     ReflectionUtils.makeAccessible(m);
     Object destination = ReflectionUtils.invokeMethod(m, endpoint);
     assertEquals("SendTo annotation not found on proxy", "foobar", destination);
   } finally {
     context.close();
   }
 }