code: public static String[] getByInternalAPI() {
          try {
              Class<?> resolverConfiguration =
                      Class.forName("sun.net.dns.ResolverConfiguration");
              Method open = resolverConfiguration.getMethod("open");
              Method getNameservers = resolverConfiguration.getMethod("nameservers");
              Object instance = open.invoke(null);
              List nameservers = (List) getNameservers.invoke(instance);
              if (nameservers == null || nameservers.size() == 0) {
                  return null;
              }
              String[] ret = new String[nameservers.size()];
              int i = 0;
              for (Object dns : nameservers) {
                  ret[i++] = (String) dns;
              }
              return ret;
          } catch (Exception e) {
              // we might trigger some problems this way
              e.printStackTrace();
          }
          return null;
      }
docs: has 300s latency when system resolv change