code: @Override
    public void stop() {
      synchronized (this) {
        setStateAndNotify(State.STOPPING);
        ArrayList<SubscriptionRecord> values = new ArrayList<>(subscriptions.values());
        for (SubscriptionRecord subscription : values) {
          doUnsubscribe(subscription.subscription);
        }
        disconnect(true);
      }
    }
docs: Unsubscribe from all active subscriptions, and disconnect the web socket.  It will not be
  possible to add new subscriptions while the {@link SubscriptionManager} is stopping
  because we check the state in {@link #doSubscribe(Subscription, Callback)}.  We pass true to
  {@link #disconnect(boolean)} because we want to disconnect even if, somehow, a new subscription
  is added while or after we are doing the {@link #doUnsubscribe(Subscription)} loop.