code: public void run() {
          setRunning(true);
          try {
              while (isRunning()) {
                  refreshSocket();
                  logHandler.debug(address + "<-- Waiting");
                  DiscoveryIncomingMessage msg = receiveMessage();
                  if (shouldMessageBeProcessed(msg)) {
                      handleQuery(msg);
                  }
              }
          }
          catch (IllegalStateException e) {
              logHandler.error(address + "<-- Cannot reopen socket, exiting listener thread: " + e.getCause(),e.getCause());
          } finally {
              if (socket != null) {
                  socket.close();
              }
              logHandler.debug(address + "<-- Stop listening");
          }
      }
docs: {@inheritDoc}