1 18 package org.apache.activemq.transport.udp; 19 20 import org.apache.activemq.command.ConsumerInfo; 21 import org.apache.activemq.command.Response; 22 import org.apache.activemq.transport.Transport; 23 import org.apache.activemq.transport.TransportFactory; 24 import org.apache.activemq.transport.TransportServer; 25 26 import java.net.URI ; 27 28 32 public class UdpTransportUsingServerTest extends UdpTestSupport { 33 34 protected int consumerPort = 9123; 35 protected String producerURI = "udp://localhost:" + consumerPort; 36 protected String serverURI = producerURI; 37 38 public void testRequestResponse() throws Exception { 39 ConsumerInfo expected = new ConsumerInfo(); 40 expected.setSelector("Edam"); 41 expected.setResponseRequired(true); 42 log.info("About to send: " + expected); 43 Response response = (Response) producer.request(expected, 2000); 44 45 log.info("Received: " + response); 46 assertNotNull("Received a response", response); 47 assertTrue("Should not be an exception", !response.isException()); 48 } 49 50 protected Transport createProducer() throws Exception { 51 log.info("Producer using URI: " + producerURI); 52 URI uri = new URI (producerURI); 53 return TransportFactory.connect(uri); 54 } 55 56 protected TransportServer createServer() throws Exception { 57 return TransportFactory.bind("byBroker", new URI (serverURI)); 58 } 59 60 protected Transport createConsumer() throws Exception { 61 return null; 62 } 63 } 64 | Popular Tags |