private synchronized void useImplicitHost(boolean noSniUpdate) { // Note: If the local name service is not trustworthy, reverse // host name resolution should not be performed for endpoint // identification. Use the application original specified // hostname or IP address instead. // Get the original hostname via jdk.internal.misc.SharedSecrets InetAddress inetAddress = getInetAddress(); if (inetAddress == null) { // not connected return; } JavaNetAccess jna = SharedSecrets.getJavaNetAccess(); String originalHostname = jna.getOriginalHostName(inetAddress); if ((originalHostname != null) && (originalHostname.length() != 0)) { host = originalHostname; if (!noSniUpdate && serverNames.isEmpty() && !noSniExtension) { serverNames = Utilities.addToSNIServerNameList(serverNames, host); if (!roleIsServer && (handshaker != null) && !handshaker.started()) { handshaker.setSNIServerNames(serverNames); } } return; } // No explicitly specified hostname, no server name indication. if (!trustNameService) { // The local name service is not trustworthy, use IP address. host = inetAddress.getHostAddress(); } else { // Use the underlying reverse host name resolution service. host = getInetAddress().getHostName(); } }