1 18 package org.apache.activemq.transport.mock; 19 20 import java.io.IOException ; 21 import java.net.URI ; 22 import java.net.URISyntaxException ; 23 24 import org.apache.activemq.transport.MutexTransport; 25 import org.apache.activemq.transport.ResponseCorrelator; 26 import org.apache.activemq.transport.Transport; 27 import org.apache.activemq.transport.TransportFactory; 28 import org.apache.activemq.transport.TransportServer; 29 import org.apache.activemq.util.IntrospectionSupport; 30 import org.apache.activemq.util.URISupport; 31 import org.apache.activemq.util.URISupport.CompositeData; 32 33 public class MockTransportFactory extends TransportFactory { 34 35 public Transport doConnect(URI location) throws URISyntaxException , Exception { 36 Transport transport = createTransport(URISupport.parseComposite(location)); 37 transport = new MutexTransport(transport); 38 transport = new ResponseCorrelator(transport); 39 return transport; 40 } 41 42 public Transport doCompositeConnect(URI location) throws URISyntaxException , Exception { 43 return createTransport(URISupport.parseComposite(location)); 44 } 45 46 51 public Transport createTransport(CompositeData compositData) throws Exception { 52 MockTransport transport = new MockTransport( TransportFactory.compositeConnect(compositData.getComponents()[0]) ); 53 IntrospectionSupport.setProperties(transport, compositData.getParameters()); 54 return transport; 55 } 56 57 public TransportServer doBind(String brokerId,URI location) throws IOException { 58 throw new IOException ("This protocol does not support being bound."); 59 } 60 61 } 62 | Popular Tags |