提交 ad4d969c 编写于 作者: W weijun

7176574: sun/security/krb5/auto/TcpTimeout.java failed with solaris-i586

Reviewed-by: chegar
上级 a97da137
...@@ -48,8 +48,14 @@ public class TcpTimeout { ...@@ -48,8 +48,14 @@ public class TcpTimeout {
k.addPrincipalRandKey("krbtgt/" + OneKDC.REALM); k.addPrincipalRandKey("krbtgt/" + OneKDC.REALM);
// Start two listener that does not communicate, simulate timeout // Start two listener that does not communicate, simulate timeout
int p1 = new ServerSocket(0).getLocalPort(); ServerSocket ss1 = null;
int p2 = new ServerSocket(0).getLocalPort(); ServerSocket ss2 = null;
try {
ss1 = new ServerSocket(0);
ss2 = new ServerSocket(0);
int p1 = ss1.getLocalPort();
int p2 = ss2.getLocalPort();
FileWriter fw = new FileWriter("alternative-krb5.conf"); FileWriter fw = new FileWriter("alternative-krb5.conf");
...@@ -65,7 +71,8 @@ public class TcpTimeout { ...@@ -65,7 +71,8 @@ public class TcpTimeout {
"}\n"); "}\n");
fw.close(); fw.close();
System.setProperty("java.security.krb5.conf", "alternative-krb5.conf"); System.setProperty("java.security.krb5.conf",
"alternative-krb5.conf");
Config.refresh(); Config.refresh();
System.out.println("Ports opened on " + p1 + ", " + p2 + ", " + p3); System.out.println("Ports opened on " + p1 + ", " + p2 + ", " + p3);
...@@ -92,5 +99,9 @@ public class TcpTimeout { ...@@ -92,5 +99,9 @@ public class TcpTimeout {
if (count != 0) { if (count != 0) {
throw new Exception("Retry count is " + count + " less"); throw new Exception("Retry count is " + count + " less");
} }
} finally {
if (ss1 != null) ss1.close();
if (ss2 != null) ss2.close();
}
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册