@@ -81,6 +81,7 @@ public class JmxTest {
81
81
static final String TRUSTSTORE_PROPERTY = "javax.net.ssl.trustStore" ;
82
82
static final String TRUSTSTORE_PASSWORD_PROPERTY = "javax.net.ssl.trustStorePassword" ;
83
83
static final String REGISTRY_SSL_PROPERTY = "com.sun.management.jmxremote.registry.ssl" ;
84
+ static final String SOCKET_FACTORY_PROPERTY = "com.sun.jndi.rmi.factory.socket" ;
84
85
static final String TEST_PORT = "12345" ;
85
86
static final String TRUE = "true" ;
86
87
static final String JMX_REMOTE_RESOURCES = "src/com.oracle.svm.test/src/com/oracle/svm/test/jmx/jmxremoteresources" ;
@@ -96,10 +97,16 @@ public static void checkForJFR() throws IOException {
96
97
System .setProperty (CLIENT_AUTH_PROPERTY , TRUE );
97
98
System .setProperty (SSL_PROPERTY , TRUE );
98
99
System .setProperty (REGISTRY_SSL_PROPERTY , TRUE );
99
- // The following are dummy password access, and SSL files required for testing
100
- // authentication and SSL .
100
+
101
+ // The following are dummy password and access files required for testing authentication .
101
102
System .setProperty (ACCESS_PROPERTY , JMX_REMOTE_RESOURCES + "/jmxremote.access" );
102
103
System .setProperty (PASSWORD_PROPERTY , JMX_REMOTE_RESOURCES + "/jmxremote.password" );
104
+
105
+ /*
106
+ * The following are dummy SSL keystore and truststore files required for testing connection
107
+ * using SSL. The clientkeystore was used to create a client certificate
108
+ * (jmxremoteresources/client.cer) which was then imported into the servertruststore.
109
+ */
103
110
System .setProperty (KEYSTORE_PROPERTY , JMX_REMOTE_RESOURCES + "/clientkeystore" );
104
111
System .setProperty (KEYSTORE_PASSWORD_PROPERTY , "clientpass" );
105
112
System .setProperty (TRUSTSTORE_PROPERTY , JMX_REMOTE_RESOURCES + "/servertruststore" );
@@ -128,7 +135,7 @@ private static MBeanServerConnection getLocalMBeanServerConnectionStatic() {
128
135
String [] credentials = {"myrole" , "MYP@SSWORD" }; // dummy password for testing
129
136
env .put (JMXConnector .CREDENTIALS , credentials );
130
137
// Include below if protecting registry with SSL
131
- env .put ("com.sun.jndi.rmi.factory.socket" , new SslRMIClientSocketFactory ());
138
+ env .put (SOCKET_FACTORY_PROPERTY , new SslRMIClientSocketFactory ());
132
139
JMXConnector connector = JMXConnectorFactory .connect (jmxUrl , env );
133
140
return connector .getMBeanServerConnection ();
134
141
} catch (IOException e ) {
0 commit comments