1 18 package org.apache.activemq.transport.udp; 19 20 import java.net.URI ; 21 22 import org.apache.activemq.openwire.OpenWireFormat; 23 import org.apache.activemq.transport.CommandJoiner; 24 import org.apache.activemq.transport.Transport; 25 import org.apache.activemq.util.IntSequenceGenerator; 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 33 public class UdpTransportTest extends UdpTestSupport { 34 35 protected static final Log log = LogFactory.getLog(UdpTransportTest.class); 36 37 protected int consumerPort = 9123; 38 protected String producerURI = "udp://localhost:" + consumerPort; 39 40 protected Transport createProducer() throws Exception { 41 log.info("Producer using URI: " + producerURI); 42 43 47 OpenWireFormat wireFormat = createWireFormat(); 48 UdpTransport transport = new UdpTransport(wireFormat, new URI (producerURI)); 49 transport.setSequenceGenerator(new IntSequenceGenerator()); 50 return new CommandJoiner(transport, wireFormat); 51 } 52 53 protected Transport createConsumer() throws Exception { 54 log.info("Consumer on port: " + consumerPort); 55 OpenWireFormat wireFormat = createWireFormat(); 56 UdpTransport transport = new UdpTransport(wireFormat, consumerPort); 57 transport.setSequenceGenerator(new IntSequenceGenerator()); 58 return new CommandJoiner(transport, wireFormat); 59 } 60 61 protected OpenWireFormat createWireFormat() { 62 return new OpenWireFormat(); 63 } 64 65 } 66 | Popular Tags |