Skip to content

Commit

Permalink
Don't blindly overwrite SSLContext when specifying URI
Browse files Browse the repository at this point in the history
ConnectionFactory#setUri always set up the default SSLContext
when a secured AMQP URI is passed in. Now, it only does so
if the sslContext property hasn't been set yet.

Fixes #297
  • Loading branch information
acogoluegnes committed Sep 5, 2017
1 parent 9328910 commit c239177
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/rabbitmq/client/ConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ public void setUri(URI uri)
// nothing special to do
} else if ("amqps".equals(uri.getScheme().toLowerCase())) {
setPort(DEFAULT_AMQP_OVER_SSL_PORT);
useSslProtocol();
// SSL context not set yet, we use the default one
if (this.sslContext != null) {
useSslProtocol();
}
} else {
throw new IllegalArgumentException("Wrong scheme in AMQP URI: " +
uri.getScheme());
Expand Down

0 comments on commit c239177

Please sign in to comment.