code: public Set<Instance> runOnceOn(InetAddress localhost) throws IOException {
          logger.debug("Running query on {}", localhost);
          initialQuestion = new Question(service, domain);
          instances = Collections.synchronizedSet(new HashSet<>());
          try {
              Thread listener = null;
              if (localhost != TEST_SUITE_ADDRESS) {
                  openSocket(localhost);
                  listener = listenForResponses();
                  while (!isServerIsListening()) {
                      logger.debug("Server is not yet listening");
                  }
              }
              ask(initialQuestion);
              if (listener != null) {
                  try {
                      listener.join();
                  } catch (InterruptedException e) {
                      logger.error("InterruptedException while listening for mDNS responses: ", e);
                  }
              }
          } finally {
              closeSocket();
          }
          return instances;
      }
docs: Synchronously runs the Query a single time.
  
  @param localhost address of the network interface to listen on
  @return a list of Instances that match this Query
  @throws IOException thrown on socket and network errors