diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransport.java index f10bba2a9f..24659f7422 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransport.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransport.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.URI; import java.net.UnknownHostException; import java.security.cert.X509Certificate; +import java.util.HashMap; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; @@ -29,6 +30,7 @@ import javax.net.ssl.SSLSocketFactory; import org.apache.activemq.command.ConnectionInfo; +import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.wireformat.WireFormat; /** @@ -59,6 +61,15 @@ public class SslTransport extends TcpTransport { super(wireFormat, socketFactory, remoteLocation, localLocation); if (this.socket != null) { ((SSLSocket)this.socket).setNeedClientAuth(needClientAuth); + + // Lets try to configure the SSL SNI field. Handy in case your using + // a single proxy to route to different messaging apps. + + // On java 1.7 it seems like it can only be configured via reflection. + // todo: find out if this will work on java 1.8 + HashMap props = new HashMap(); + props.put("host", remoteLocation.getHost()); + IntrospectionSupport.setProperties(this.socket, props); } }