KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > transport > multicast > MulticastTransportTest


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.transport.multicast;
19
20 import java.net.URI JavaDoc;
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.transport.udp.UdpTransportTest;
26 import org.apache.activemq.util.IntSequenceGenerator;
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 /**
31  *
32  * @version $Revision: 426366 $
33  */

34 public class MulticastTransportTest extends UdpTransportTest {
35     
36     protected static final Log log = LogFactory.getLog(MulticastTransportTest.class);
37
38     private String JavaDoc multicastURI = "multicast://224.1.2.3:6255";
39     
40
41     protected Transport createProducer() throws Exception JavaDoc {
42         log.info("Producer using URI: " + multicastURI);
43         
44         // we are not using the TransportFactory as this assumes that
45
// transports talk to a server using a WireFormat Negotiation step
46
// rather than talking directly to each other
47

48         OpenWireFormat wireFormat = createWireFormat();
49         MulticastTransport transport = new MulticastTransport(wireFormat, new URI JavaDoc(multicastURI));
50         transport.setLoopBackMode(false);
51         transport.setSequenceGenerator(new IntSequenceGenerator());
52         return new CommandJoiner(transport, wireFormat);
53     }
54
55     protected Transport createConsumer() throws Exception JavaDoc {
56         OpenWireFormat wireFormat = createWireFormat();
57         MulticastTransport transport = new MulticastTransport(wireFormat, new URI JavaDoc(multicastURI));
58         transport.setLoopBackMode(false);
59         transport.setSequenceGenerator(new IntSequenceGenerator());
60         return new CommandJoiner(transport, wireFormat);
61     }
62
63
64 }
65
Popular Tags