@@ -61,7 +61,6 @@ public class ManagementContextSslTest {
6161 private SSLContext savedDefaultSslContext ;
6262 private String savedTrustStore ;
6363 private String savedTrustStorePassword ;
64- private String savedRmiHostname ;
6564
6665 @ BeforeClass
6766 public static void createKeyStore () throws Exception {
@@ -110,7 +109,6 @@ public void setUp() throws Exception {
110109 savedDefaultSslContext = SSLContext .getDefault ();
111110 savedTrustStore = System .getProperty ("javax.net.ssl.trustStore" );
112111 savedTrustStorePassword = System .getProperty ("javax.net.ssl.trustStorePassword" );
113- savedRmiHostname = System .getProperty ("java.rmi.server.hostname" );
114112 }
115113
116114 @ After
@@ -121,7 +119,6 @@ public void tearDown() throws Exception {
121119 SSLContext .setDefault (savedDefaultSslContext );
122120 restoreSystemProperty ("javax.net.ssl.trustStore" , savedTrustStore );
123121 restoreSystemProperty ("javax.net.ssl.trustStorePassword" , savedTrustStorePassword );
124- restoreSystemProperty ("java.rmi.server.hostname" , savedRmiHostname );
125122 }
126123
127124 @ Test
@@ -195,9 +192,6 @@ public void testConnectorStartsWithSsl() throws Exception {
195192 SSLContext .setDefault (testSslContext );
196193 System .setProperty ("javax.net.ssl.trustStore" , keystoreFile .toString ());
197194 System .setProperty ("javax.net.ssl.trustStorePassword" , KEYSTORE_PASSWORD );
198- // Force RMI stubs to advertise "localhost" so SSL hostname verification
199- // matches the certificate SAN (dns:localhost) instead of the machine's IP.
200- System .setProperty ("java.rmi.server.hostname" , "localhost" );
201195
202196 context = createSslManagementContext ();
203197 context .start ();
@@ -217,11 +211,6 @@ public void testSslJmxConnectionSucceeds() throws Exception {
217211 SSLContext .setDefault (testSslContext );
218212 System .setProperty ("javax.net.ssl.trustStore" , keystoreFile .toString ());
219213 System .setProperty ("javax.net.ssl.trustStorePassword" , KEYSTORE_PASSWORD );
220- // Force RMI stubs to advertise "localhost" so SSL hostname verification
221- // matches the certificate SAN (dns:localhost) instead of the machine's actual IP.
222- // RMI normally embeds InetAddress.getLocalHost() in stubs; on a multi-homed
223- // machine this can be an IP not covered by the test certificate.
224- System .setProperty ("java.rmi.server.hostname" , "localhost" );
225214
226215 context = createSslManagementContext ();
227216 context .start ();
0 commit comments