@Test
  public void testQueue() throws Exception {
    ClassPathXmlApplicationContext context =
        new ClassPathXmlApplicationContext("gemfire-queue-config.xml", this.getClass());

    QueueChannel gemfireQueue = context.getBean("gemfireQueue", QueueChannel.class);
    QueueChannel outputQueue = context.getBean("outputQueue", QueueChannel.class);

    for (int i = 0; i < 20; i++) {
      gemfireQueue.send(new GenericMessage<String>("Hello"));
      Thread.sleep(1);
    }
    for (int i = 0; i < 20; i++) {
      assertNotNull(outputQueue.receive(5000));
    }
    assertNull(outputQueue.receive(1));
    context.close();
  }
 @Test
 public void subscription() throws Exception {
   TestApplicationContext context = TestUtils.createTestApplicationContext();
   SynchronousQueue<String> queue = new SynchronousQueue<String>();
   TestBean testBean = new TestBean(queue);
   QueueChannel channel = new QueueChannel();
   context.registerChannel("channel", channel);
   Message<String> message = new GenericMessage<String>("testing");
   channel.send(message);
   assertNull(queue.poll());
   MethodInvokingMessageHandler handler = new MethodInvokingMessageHandler(testBean, "foo");
   PollingConsumer endpoint = new PollingConsumer(channel, handler);
   endpoint.setTrigger(new PeriodicTrigger(10));
   context.registerEndpoint("testEndpoint", endpoint);
   context.refresh();
   String result = queue.poll(2000, TimeUnit.MILLISECONDS);
   assertNotNull(result);
   assertEquals("testing", result);
   context.stop();
 }