@Test
public void testRDNS() throws Exception {

  InetAddress localhost = getLocalIPAddr();
  try {
    String s = DNS.reverseDns(localhost, null);
    LOG.info("Local reverse DNS hostname is " + s);
  } catch (NameNotFoundException | CommunicationException e) {
    if (!localhost.isLinkLocalAddress() || localhost.isLoopbackAddress()) {
      //these addresses probably won't work with rDNS anyway, unless someone
      //has unusual entries in their DNS server mapping 1.0.0.127 to localhost
      LOG.info("Reverse DNS failing as due to incomplete networking", e);
      LOG.info("Address is " + localhost
              + " Loopback=" + localhost.isLoopbackAddress()
              + " Linklocal=" + localhost.isLinkLocalAddress());
    }
  }
}