jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java
changeset 38323 9653a8faa2b9
parent 37601 6517589dcc94
equal deleted inserted replaced
38322:f6f9d3ec14ba 38323:9653a8faa2b9
    32  * @summary Custom HostnameVerifier disables SNI extension
    32  * @summary Custom HostnameVerifier disables SNI extension
    33  * @run main/othervm BestEffortOnLazyConnected
    33  * @run main/othervm BestEffortOnLazyConnected
    34  */
    34  */
    35 
    35 
    36 import java.io.*;
    36 import java.io.*;
    37 import java.nio.*;
       
    38 import java.nio.channels.*;
       
    39 import java.util.*;
       
    40 import java.net.*;
    37 import java.net.*;
    41 import javax.net.ssl.*;
    38 import javax.net.ssl.*;
    42 
    39 
    43 public class BestEffortOnLazyConnected {
    40 public class BestEffortOnLazyConnected {
    44 
    41 
   195         System.out.println(
   192         System.out.println(
   196                 "The fully qualified domain name of the local host is " +
   193                 "The fully qualified domain name of the local host is " +
   197                 hostname);
   194                 hostname);
   198         // Ignore the test if the hostname does not sound like a domain name.
   195         // Ignore the test if the hostname does not sound like a domain name.
   199         if ((hostname == null) || hostname.isEmpty() ||
   196         if ((hostname == null) || hostname.isEmpty() ||
       
   197                 !hostname.contains(".") || hostname.endsWith(".") ||
   200                 hostname.startsWith("localhost") ||
   198                 hostname.startsWith("localhost") ||
   201                 Character.isDigit(hostname.charAt(hostname.length() - 1))) {
   199                 Character.isDigit(hostname.charAt(hostname.length() - 1))) {
   202 
   200 
   203             System.out.println("Ignore the test as the local hostname " +
   201             System.out.println("Ignore the test as the local hostname " +
   204                     "cannot be determined as fully qualified domain name");
   202                     "cannot be determined as fully qualified domain name");