1 17 package org.apache.activemq.bugs; 18 19 import org.apache.activemq.ActiveMQConnectionFactory; 20 import org.apache.activemq.EmbeddedBrokerTestSupport; 21 import org.apache.activemq.command.ActiveMQQueue; 22 23 import javax.jms.Connection ; 24 import javax.jms.JMSException ; 25 import javax.jms.Message ; 26 import javax.jms.MessageConsumer ; 27 import javax.jms.Session ; 28 29 33 public class CraigsBugTest extends EmbeddedBrokerTestSupport { 34 35 public void testConnectionFactory() throws Exception { 36 final ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); 37 final ActiveMQQueue queue = new ActiveMQQueue("testqueue"); 38 final Connection conn = cf.createConnection(); 39 40 Runnable r = new Runnable () { 41 public void run() { 42 try { 43 Session session = conn.createSession(false, 1); 44 MessageConsumer consumer = session.createConsumer(queue, null); 45 Message msg = consumer.receive(1000); 46 } 47 catch (JMSException e) { 48 e.printStackTrace(); 49 } 50 } 51 }; 52 new Thread (r).start(); 53 conn.start(); 54 55 try { 56 synchronized (this) { 57 wait(3000); 58 } 59 } 60 catch (InterruptedException e) { 61 e.printStackTrace(); 62 } 63 } 64 65 protected void setUp() throws Exception { 66 bindAddress = "tcp://localhost:61616"; 67 super.setUp(); 68 } 69 70 71 } 72 | Popular Tags |