code: public static String getFqdnHost(InetSocketAddress addr) {
      Preconditions.checkNotNull(addr.getAddress(), "the address of " + addr + " is invalid.");
      return addr.getAddress().getCanonicalHostName();
    }
docs: Gets FQDN(Full Qualified Domain Name) from Java representations of network address, except
  String representation which should be handled by {@link #resolveHostName(String)} which will
  handle the situation where hostname is null.
  
  @param addr the input network address representation, can not be null
  @return the resolved FQDN host name