# HG changeset patch # User igerasim # Date 1475261730 -10800 # Node ID 0c2c07d0864dc3dd2d05ad277b72f24d5717a355 # Parent c2710897612520f3e7a0c27aaef01401f2ebfc08 8077670: sun/security/krb5/auto/MaxRetries.java may fail with BindException Reviewed-by: chegar diff -r c27108976125 -r 0c2c07d0864d test/sun/security/krb5/auto/MaxRetries.java --- a/test/sun/security/krb5/auto/MaxRetries.java Fri Nov 24 05:00:54 2017 +0000 +++ b/test/sun/security/krb5/auto/MaxRetries.java Fri Sep 30 21:55:30 2016 +0300 @@ -34,14 +34,18 @@ import java.security.Security; public class MaxRetries { + + static int idlePort = -1; + public static void main(String[] args) throws Exception { System.setProperty("sun.security.krb5.debug", "true"); new OneKDC(null).writeJAASConf(); - // An idle UDP socket to revent PortUnreachableException - DatagramSocket ds = new DatagramSocket(33333); + // An idle UDP socket to prevent PortUnreachableException + DatagramSocket ds = new DatagramSocket(); + idlePort = ds.getLocalPort(); System.setProperty("java.security.krb5.conf", "alternative-krb5.conf"); @@ -200,7 +204,7 @@ fw.write(" kdc_timeout = " + BadKdc.toReal(value*1000) + "\n"); } // Add a bad KDC as the first candidate - fw.write(" kdc = localhost:33333\n"); + fw.write(" kdc = localhost:" + idlePort + "\n"); } fw.write(s + "\n"); }