code: public void doReconnect() {
          if(!tryReconnection) return;
  
          if(nextReconnectInterval == 0){
              nextReconnectInterval = (int)(2000 * Math.pow(2, count));
          } else {
              nextReconnectInterval = (int)(nextReconnectInterval * Math.pow(2, count));
          }
  
          if(nextReconnectInterval > maxRetryInterval){
              nextReconnectInterval = maxRetryInterval;
          }
          if(count <= maxRetries) {
              if(canReconnect) {
                  count++;
                  reconnect(new ArrayList<>(subscribedTokens));
                  canReconnect = false;
                  canReconnectTimer = new Timer();
                  canReconnectTimer.schedule(new TimerTask() {
                      @Override
                      public void run() {
                          canReconnect = true;
                      }
                  }, nextReconnectInterval);
              }
          }else if(count > maxRetries) {
              // if number of tries exceeds maximum number of retries then stop timer.
              if(timer != null) {
                  timer.cancel();
                  timer = null;
              }
          }
      }
docs: Performs reconnection after a particular interval if count is less than maximum retries.