code: public static String getHostname(InetSocketAddress addr) {
          return PlatformDependent.javaVersion() >= 7 ? addr.getHostString() : addr.getHostName();
      }
docs: Returns {@link InetSocketAddress#getHostString()} if Java >= 7,
  or {@link InetSocketAddress#getHostName()} otherwise.
  @param addr The address
  @return the host string