--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Thu Nov 08 12:51:25 2012 -0500
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Fri Nov 09 01:15:04 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,13 +21,15 @@
* questions.
*/
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
/**
* @test
* @bug 4302026
* @run main/othervm GetPeerHost
- *
- * SunJSSE does not support dynamic system properties, no way to re-use
- * system properties in samevm/agentvm mode.
* @summary make sure the server side doesn't do DNS lookup.
*/
import javax.net.*;
@@ -41,7 +43,8 @@
+ "/../../../../../../../etc/truststore");
GetPeerHostServer server = new GetPeerHostServer();
server.start();
- GetPeerHostClient client = new GetPeerHostClient();
+ GetPeerHostClient client =
+ new GetPeerHostClient(server.getServerPort());
client.start();
server.join ();
if (!server.getPassStatus ()) {
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHostClient.java Thu Nov 08 12:51:25 2012 -0500
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHostClient.java Fri Nov 09 01:15:04 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,13 +38,13 @@
SSLSocket s;
String server;
- public GetPeerHostClient ()
+ public GetPeerHostClient (int serverPort)
{
try {
SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory
.getDefault();
server = InetAddress.getLocalHost().getHostName();
- s = (SSLSocket) factory.createSocket(server, 9999);
+ s = (SSLSocket) factory.createSocket(server, serverPort);
System.out.println("CLIENT: connected to the server- " + server);
} catch (Exception e) {
System.err.println("Unexpected exceptions: " + e);
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHostServer.java Thu Nov 08 12:51:25 2012 -0500
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHostServer.java Fri Nov 09 01:15:04 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
private String host;
ServerSocket ss;
boolean isHostIPAddr = false;
+ int serverPort = 0;
public GetPeerHostServer ()
{
@@ -57,7 +58,8 @@
kmf.init(ks, passphrase);
ctx.init(kmf.getKeyManagers(), null, null);
ServerSocketFactory ssf = ctx.getServerSocketFactory();
- ss = ssf.createServerSocket(9999);
+ ss = ssf.createServerSocket(serverPort);
+ serverPort = ss.getLocalPort();
}catch (Exception e) {
System.err.println("Unexpected exceptions: " + e);
e.printStackTrace();
@@ -90,4 +92,8 @@
boolean getPassStatus () {
return isHostIPAddr;
}
+
+ int getServerPort() {
+ return serverPort;
+ }
}