code: public void stop() {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Stopping client");
      }
  
      if (!running.compareAndSet(true, false)) {
        return;
      }
      
      synchronized (connections) {
        // wake up all connections
        for (Connection conn : connections.values()) {
          conn.interrupt();
        }
        // wait until all connections are closed
        while (!connections.isEmpty()) {
          try {
            connections.wait();
          } catch (InterruptedException e) {
            // pass
          }
        }
      }
    }
docs: Stop all threads related to this client.  No further calls may be made
  using this client.