/** * 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 */ @Override protected Transport createTransport() throws JMSException { SslContext existing = SslContext.getCurrentSslContext(); try { if (keyStore != null || trustStore != null) { keyManager = createKeyManager(); trustManager = createTrustManager(); } if (keyManager != null || trustManager != null) { SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom)); } return super.createTransport(); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } finally { SslContext.setCurrentSslContext(existing); } }
Transport transport = createTransport(); connection = createActiveMQConnection(transport, factoryStats);
/** * 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); } }
/** * 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 */ @Override protected Transport createTransport() throws JMSException { SslContext existing = SslContext.getCurrentSslContext(); try { if (keyStore != null || trustStore != null) { keyManager = createKeyManager(); trustManager = createTrustManager(); } if (keyManager != null || trustManager != null) { SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom)); } return super.createTransport(); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } finally { SslContext.setCurrentSslContext(existing); } }
/** * 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 */ @Override protected Transport createTransport() throws JMSException { SslContext existing = SslContext.getCurrentSslContext(); try { if (keyStore != null || trustStore != null) { keyManager = createKeyManager(); trustManager = createTrustManager(); } if (keyManager != null || trustManager != null) { SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom)); } return super.createTransport(); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } finally { SslContext.setCurrentSslContext(existing); } }
/** * 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 */ @Override protected Transport createTransport() throws JMSException { SslContext existing = SslContext.getCurrentSslContext(); try { if (keyStore != null || trustStore != null) { keyManager = createKeyManager(); trustManager = createTrustManager(); } if (keyManager != null || trustManager != null) { SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom)); } return super.createTransport(); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } finally { SslContext.setCurrentSslContext(existing); } }
Transport transport = createTransport(); connection = createActiveMQConnection(transport, factoryStats);
Transport transport = createTransport(); connection = createActiveMQConnection(transport, factoryStats);
Transport transport = createTransport(); connection = createActiveMQConnection(transport, factoryStats);
Transport transport = createTransport(); connection = createActiveMQConnection(transport, factoryStats);