code: private void startHandleChallenges(JSONObject jsonChallenges, Response response) {
          ArrayList<String> challenges = getRealmsFromJson(jsonChallenges);
  
          MCAAuthorizationManager authManager = (MCAAuthorizationManager) BMSClient.getInstance().getAuthorizationManager();
  
          if (isAuthorizationRequired(response)) {
              setExpectedAnswers(challenges);
          }
  
          for (String realm : challenges) {
              ChallengeHandler handler = authManager.getChallengeHandler(realm);
              if (handler != null) {
                  JSONObject challenge = jsonChallenges.optJSONObject(realm);
                  handler.handleChallenge(this, challenge, context);
              } else {
                  throw new RuntimeException("Challenge handler for realm is not found: " + realm);
              }
          }
      }
docs: Handles authentication challenges.
  
  @param jsonChallenges Collection of challenges.
  @param response       Server response.