docs: public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) {
      boolean refreshToken = false;
      boolean bearer = false;
  
      List<String> authenticateList = response.getHeaders().getAuthenticateAsList();
  
      // TODO(peleyal): this logic should be implemented as a pluggable interface, in the same way we
      // implement different AccessMethods
  
      // if authenticate list is not null we will check if one of the entries contains "Bearer"
      if (authenticateList != null) {
        for (String authenticate : authenticateList) {
          if (authenticate.startsWith(BearerToken.AuthorizationHeaderAccessMethod.HEADER_PREFIX)) {
            // mark that we found a "Bearer" value, and check if there is a invalid_token error
            bearer = true;
            refreshToken = BearerToken.INVALID_TOKEN_ERROR.matcher(authenticate).find();
            break;
          }
        }
      }
  
      // if "Bearer" wasn't found, we will refresh the token, if we got 401
      if (!bearer) {
        refreshToken = response.getStatusCode() == HttpStatusCodes.STATUS_CODE_UNAUTHORIZED;
      }
  
      if (refreshToken) {
        try {
          lock.lock();
          try {
            // need to check if another thread has already refreshed the token
            return !Objects.equal(accessToken, method.getAccessTokenFromRequest(request))
                || refreshToken();
          } finally {
            lock.unlock();
          }
        } catch (IOException exception) {
          LOGGER.log(Level.SEVERE, "unable to refresh token", exception);
        }
      }
      return false;
    }