code: static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
          SecurityManager sm = System.getSecurityManager();
          if (addr == null || sm == null)
              return addr;
  
          if (!getRevealLocalAddress()) {
              // Return loopback address only if security check fails
              try{
                  sm.checkConnect(addr.getAddress().getHostAddress(), -1);
                  //Security check passed
              } catch (SecurityException e) {
                  //Return loopback address
                  addr = getLoopbackAddress(addr.getPort());
              }
          }
          return addr;
      }
docs: Returns the local address after performing a SecurityManager#checkConnect.