Java Code Examples for org.apache.activemq.broker.BrokerService#setSslContext()
The following examples show how to use
org.apache.activemq.broker.BrokerService#setSslContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FailoverStaticNetworkTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker(String scheme, String listenPort, String[] networkToPorts, HashMap<String, String> networkProps) throws Exception { BrokerService broker = new BrokerService(); broker.getManagementContext().setCreateConnector(false); broker.setSslContext(sslContext); broker.setDeleteAllMessagesOnStartup(true); broker.setBrokerName("Broker_" + listenPort); // lazy init listener on broker start TransportConnector transportConnector = new TransportConnector(); transportConnector.setUri(new URI(scheme + "://localhost:" + listenPort)); List<TransportConnector> transportConnectors = new ArrayList<>(); transportConnectors.add(transportConnector); broker.setTransportConnectors(transportConnectors); if (networkToPorts != null && networkToPorts.length > 0) { StringBuilder builder = new StringBuilder("static:(failover:(" + scheme + "://localhost:"); builder.append(networkToPorts[0]); for (int i = 1; i < networkToPorts.length; i++) { builder.append("," + scheme + "://localhost:" + networkToPorts[i]); } // limit the reconnects in case of initial random connection to slave // leaving randomize on verifies that this config is picked up builder.append(")?maxReconnectAttempts=0)?useExponentialBackOff=false"); NetworkConnector nc = broker.addNetworkConnector(builder.toString()); if (networkProps != null) { IntrospectionSupport.setProperties(nc, networkProps); } } return broker; }
Example 2
Source File: JmsWSSConnectionTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setAdvisorySupport(false); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setUseJmx(false); // Setup broker SSL context... TransportOptions sslOptions = new TransportOptions(); sslOptions.setKeyStoreLocation(KEYSTORE); sslOptions.setKeyStorePassword(PASSWORD); sslOptions.setVerifyHost(false); SSLContext sslContext = TransportSupport.createJdkSslContext(sslOptions); final SslContext brokerContext = new SslContext(); brokerContext.setSSLContext(sslContext); brokerService.setSslContext(brokerContext); TransportConnector connector = brokerService.addConnector("wss://0.0.0.0:" + getProxyPort()); connectionURI = connector.getPublishableConnectURI(); LOG.debug("Using amqp+wss connection: {}", connectionURI); brokerService.start(); brokerService.waitUntilStarted(); connectionURI = connector.getPublishableConnectURI(); }
Example 3
Source File: JmsSSLConnectionTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setAdvisorySupport(false); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setUseJmx(false); // Setup broker SSL context... TransportOptions sslOptions = new TransportOptions(); sslOptions.setKeyStoreLocation(KEYSTORE); sslOptions.setKeyStorePassword(PASSWORD); sslOptions.setVerifyHost(false); SSLContext sslContext = TransportSupport.createJdkSslContext(sslOptions); final SslContext brokerContext = new SslContext(); brokerContext.setSSLContext(sslContext); brokerService.setSslContext(brokerContext); TransportConnector connector = brokerService.addConnector("amqp+ssl://localhost:0"); brokerService.start(); brokerService.waitUntilStarted(); connectionURI = connector.getPublishableConnectURI(); }