jdk/test/sun/security/krb5/auto/MaxRetries.java
changeset 12842 f6f9cb8f6b97
parent 8396 587947f96036
child 14327 c0d86f6f8be8
equal deleted inserted replaced
12704:c516c24fa010 12842:f6f9cb8f6b97
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 6844193
    26  * @bug 6844193
       
    27  * @compile -XDignore.symbol.file MaxRetries.java
    27  * @run main/othervm/timeout=300 MaxRetries
    28  * @run main/othervm/timeout=300 MaxRetries
    28  * @summary support max_retries in krb5.conf
    29  * @summary support max_retries in krb5.conf
    29  */
    30  */
    30 
    31 
    31 import java.io.*;
    32 import java.io.*;
       
    33 import java.net.DatagramSocket;
    32 import java.security.Security;
    34 import java.security.Security;
    33 
    35 
    34 public class MaxRetries {
    36 public class MaxRetries {
    35     public static void main(String[] args)
    37     public static void main(String[] args)
    36             throws Exception {
    38             throws Exception {
    37 
    39 
    38         System.setProperty("sun.security.krb5.debug", "true");
    40         System.setProperty("sun.security.krb5.debug", "true");
    39         new OneKDC(null).writeJAASConf();
    41         new OneKDC(null).writeJAASConf();
       
    42 
       
    43         // An idle UDP socket to revent PortUnreachableException
       
    44         DatagramSocket ds = new DatagramSocket(33333);
       
    45 
    40         System.setProperty("java.security.krb5.conf", "alternative-krb5.conf");
    46         System.setProperty("java.security.krb5.conf", "alternative-krb5.conf");
    41 
    47 
    42         // For tryLast
    48         // For tryLast
    43         Security.setProperty("krb5.kdc.bad.policy", "trylast");
    49         Security.setProperty("krb5.kdc.bad.policy", "trylast");
    44         rewriteMaxRetries(4);
    50         rewriteMaxRetries(4);
    76         rewriteUdpPrefLimit(10, 10000); // realm rules
    82         rewriteUdpPrefLimit(10, 10000); // realm rules
    77         test2("UDP");
    83         test2("UDP");
    78 
    84 
    79         rewriteUdpPrefLimit(10000, 10); // realm rules
    85         rewriteUdpPrefLimit(10000, 10); // realm rules
    80         test2("TCP");
    86         test2("TCP");
       
    87 
       
    88         ds.close();
    81     }
    89     }
    82 
    90 
    83     /**
    91     /**
    84      * One round of test for max_retries and timeout.
    92      * One round of test for max_retries and timeout.
    85      * @param timeout the expected timeout
    93      * @param timeout the expected timeout