SslTransportFactory transportFactory = new SslTransportFactory(); return transportFactory.doBind(brokerURI); } finally { SslContext.setCurrentSslContext(null);
/** * Overriding to use SslTransportServer and allow for proper reflection. */ @Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); SslTransportServer server = createSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
/** * Overriding to use SslTransports. */ @Override protected Transport createTransport(URI location, WireFormat wf) throws UnknownHostException, IOException { URI localLocation = null; String path = location.getPath(); // see if the path is a local URI location if (path != null && path.length() > 0) { int localPortIndex = path.indexOf(':'); try { Integer.parseInt(path.substring(localPortIndex + 1, path.length())); String localString = location.getScheme() + ":/" + path; localLocation = new URI(localString); } catch (Exception e) { LOG.warn("path isn't a valid local location for SslTransport to use", e); } } SocketFactory socketFactory = createSocketFactory(); return new SslTransport(wf, (SSLSocketFactory)socketFactory, location, localLocation, false); }
@SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { transport = new MQTTTransportFilter(transport, format, brokerService); IntrospectionSupport.setProperties(transport, options); return super.compositeConfigure(transport, format, options); }
@SuppressWarnings("rawtypes") @Override public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { transport = super.serverConfigure(transport, format, options); // strip off the mutex transport. if (transport instanceof MutexTransport) { transport = ((MutexTransport) transport).getNext(); } return transport; }
/** * Overriding to use SslTransportServer and allow for proper reflection. */ public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); SslTransportServer server = new SslTransportServer(this, location, (SSLServerSocketFactory)serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
/** * Overriding to make special considerations for SSL connections. If we are * not using SSL, the superclass's method is called. If we are using SSL, an * SslConnectionFactory is used and it is given the needed key and trust * managers. * * @author sepandm@gmail.com */ protected Transport createTransport() throws JMSException { // If the given URI is non-ssl, let superclass handle it. if (!brokerURL.getScheme().equals("ssl")) { return super.createTransport(); } try { if (keyManager == null || trustManager == null) { trustManager = createTrustManager(); keyManager = createKeyManager(); // secureRandom can be left as null } SslTransportFactory sslFactory = new SslTransportFactory(); SslContext ctx = new SslContext(keyManager, trustManager, secureRandom); SslContext.setCurrentSslContext(ctx); return sslFactory.doConnect(brokerURL); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } }
@Override protected SslTransportServer createSslTransportServer(URI location, SSLServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException { final SslTransportServer server = super.createSslTransportServer(location, serverSocketFactory); server.setAllowLinkStealing(true); return server; }
@SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { transport = new MQTTTransportFilter(transport, format, brokerService); IntrospectionSupport.setProperties(transport, options); return super.compositeConfigure(transport, format, options); }
@SuppressWarnings("rawtypes") @Override public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { transport = super.serverConfigure(transport, format, options); // strip off the mutex transport. if (transport instanceof MutexTransport) { transport = ((MutexTransport) transport).getNext(); } return transport; }
@Override protected SslTransportServer createSslTransportServer(URI location, SSLServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException { final SslTransportServer server = super.createSslTransportServer(location, serverSocketFactory); server.setAllowLinkStealing(true); return server; }
/** * Overriding to use SslTransportServer and allow for proper reflection. */ @Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); SslTransportServer server = createSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
SslTransportFactory transportFactory = new SslTransportFactory(); return transportFactory.doBind(brokerURI); } finally { SslContext.setCurrentSslContext(null);
@Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { transport = new StompTransportFilter(transport, format, brokerContext); IntrospectionSupport.setProperties(transport, options); return super.compositeConfigure(transport, format, options); }
@SuppressWarnings("rawtypes") @Override public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { transport = super.serverConfigure(transport, format, options); MutexTransport mutex = transport.narrow(MutexTransport.class); if (mutex != null) { mutex.setSyncOnCommand(true); } return transport; }
/** * Overriding to use SslTransports. */ @Override protected Transport createTransport(URI location, WireFormat wf) throws UnknownHostException, IOException { URI localLocation = null; String path = location.getPath(); // see if the path is a local URI location if (path != null && path.length() > 0) { int localPortIndex = path.indexOf(':'); try { Integer.parseInt(path.substring(localPortIndex + 1, path.length())); String localString = location.getScheme() + ":/" + path; localLocation = new URI(localString); } catch (Exception e) { LOG.warn("path isn't a valid local location for SslTransport to use", e); } } SocketFactory socketFactory = createSocketFactory(); return new SslTransport(wf, (SSLSocketFactory)socketFactory, location, localLocation, false); }
@Override protected SslTransportServer createSslTransportServer(URI location, SSLServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException { final SslTransportServer server = super.createSslTransportServer(location, serverSocketFactory); server.setAllowLinkStealing(true); return server; }
/** * Overriding to use SslTransportServer and allow for proper reflection. */ @Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); SslTransportServer server = createSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory); server.setWireFormatFactory(createWireFormatFactory(options)); IntrospectionSupport.setProperties(server, options); Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport."); server.setTransportOption(transportOptions); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
SslTransportFactory transportFactory = new SslTransportFactory(); return transportFactory.doBind(brokerURI); } finally { SslContext.setCurrentSslContext(null);
@Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { transport = new StompTransportFilter(transport, format, brokerContext); IntrospectionSupport.setProperties(transport, options); return super.compositeConfigure(transport, format, options); }