code: static boolean isValidHostNameForSNI(String hostname) {
          return hostname != null &&
                 hostname.indexOf('.') > 0 &&
                 !hostname.endsWith(".") &&
                 !NetUtil.isValidIpV4Address(hostname) &&
                 !NetUtil.isValidIpV6Address(hostname);
      }
docs: Validate that the given hostname can be used in SNI extension.