code: public static String toSocketAddressString(InetSocketAddress addr) {
          String port = String.valueOf(addr.getPort());
          final StringBuilder sb;
  
          if (addr.isUnresolved()) {
              String hostname = getHostname(addr);
              sb = newSocketAddressStringBuilder(hostname, port, !isValidIpV6Address(hostname));
          } else {
              InetAddress address = addr.getAddress();
              String hostString = toAddressString(address);
              sb = newSocketAddressStringBuilder(hostString, port, address instanceof Inet4Address);
          }
          return sb.append(':').append(port).toString();
      }
docs: Returns the {@link String} representation of an {@link InetSocketAddress}.
  <p>
  The output does not include Scope ID.
  @param addr {@link InetSocketAddress} to be converted to an address string
  @return {@code String} containing the text-formatted IP address