ARTEMIS-2937 Changing BrokerConnection SSL example to also use SSL on the client

This commit is contained in:
Clebert Suconic 2020-10-29 08:48:16 -04:00
parent 753dac47d8
commit 9335cd83ed
3 changed files with 6 additions and 5 deletions

View File

@ -102,7 +102,7 @@ under the License.
<spawn>true</spawn> <spawn>true</spawn>
<ignore>${noServer}</ignore> <ignore>${noServer}</ignore>
<location>${basedir}/target/server0</location> <location>${basedir}/target/server0</location>
<testURI>tcp://localhost:5660</testURI> <testURI>tcp://localhost:5671</testURI>
<args> <args>
<param>run</param> <param>run</param>
</args> </args>

View File

@ -35,7 +35,7 @@ public class BrokerConnectionSenderSSL {
public static void main(final String[] args) throws Exception { public static void main(final String[] args) throws Exception {
Connection connectionOnServer0 = null; Connection connectionOnServer0 = null;
ConnectionFactory connectionFactoryServer0 = new JmsConnectionFactory("amqp://localhost:5660"); ConnectionFactory connectionFactoryServer0 = new JmsConnectionFactory("amqps://localhost:5672?transport.trustStoreLocation=target/server0/etc/activemq.example.truststore&transport.trustStorePassword=activemqexample&transport.verifyHost=false");
// Step 1. Create a connection on server0, and send a few messages // Step 1. Create a connection on server0, and send a few messages
try { try {
@ -50,7 +50,7 @@ public class BrokerConnectionSenderSSL {
sender.send(session.createTextMessage("Hello world overSSL n" + i)); sender.send(session.createTextMessage("Hello world overSSL n" + i));
} }
} finally { } finally {
if (connectionFactoryServer0 != null) { if (connectionOnServer0 != null) {
connectionOnServer0.close(); connectionOnServer0.close();
} }
} }
@ -58,7 +58,7 @@ public class BrokerConnectionSenderSSL {
// Step 2. create a connection on server1, and receive a few messages. // Step 2. create a connection on server1, and receive a few messages.
// the sender on the broker conneciton will take care of the transfer. // the sender on the broker conneciton will take care of the transfer.
Connection connectionOnServer1 = null; Connection connectionOnServer1 = null;
ConnectionFactory connectionFactoryServer1 = new JmsConnectionFactory("amqp://localhost:5771"); ConnectionFactory connectionFactoryServer1 = new JmsConnectionFactory("amqps://localhost:5772?transport.trustStoreLocation=target/server1/etc/activemq.example.truststore&transport.trustStorePassword=activemqexample&transport.verifyHost=false");
try { try {
connectionOnServer1 = connectionFactoryServer1.createConnection(); connectionOnServer1 = connectionFactoryServer1.createConnection();

View File

@ -31,7 +31,8 @@ under the License.
<!-- Acceptors --> <!-- Acceptors -->
<acceptors> <acceptors>
<!-- keystores will be found automatically if they are on the classpath --> <!-- keystores will be found automatically if they are on the classpath -->
<acceptor name="artemis">tcp://0.0.0.0:5660?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor> <acceptor name="artemis">tcp://0.0.0.0:5671?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor>
<acceptor name="netty-ssl-acceptor">tcp://localhost:5672?sslEnabled=true;keyStorePath=activemq.example.keystore;keyStorePassword=activemqexample;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE</acceptor>
</acceptors> </acceptors>
<broker-connections> <broker-connections>