Skip to content

Commit c239177

Browse files
committed
Don't blindly overwrite SSLContext when specifying URI
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
1 parent 9328910 commit c239177

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/rabbitmq/client/ConnectionFactory.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ public void setUri(URI uri)
226226
// nothing special to do
227227
} else if ("amqps".equals(uri.getScheme().toLowerCase())) {
228228
setPort(DEFAULT_AMQP_OVER_SSL_PORT);
229-
useSslProtocol();
229+
// SSL context not set yet, we use the default one
230+
if (this.sslContext != null) {
231+
useSslProtocol();
232+
}
230233
} else {
231234
throw new IllegalArgumentException("Wrong scheme in AMQP URI: " +
232235
uri.getScheme());

0 commit comments

Comments
 (0)