@VisibleForTesting
  RangerExportPolicyList exportRangerPoliciesPlain(String finalUrl, HiveConf hiveConf) throws Exception {

    WebResource.Builder builder = getRangerResourceBuilder(finalUrl, hiveConf);
    RangerExportPolicyList rangerExportPolicyList = new RangerExportPolicyList();
    ClientResponse clientResp = builder.get(ClientResponse.class);
    String response = null;
    if (clientResp != null) {
      if (clientResp.getStatus() == HttpServletResponse.SC_OK) {
        Gson gson = new GsonBuilder().create();
        response = clientResp.getEntity(String.class);
        LOG.debug("Response received for ranger export {} ", response);
        if (StringUtils.isNotEmpty(response)) {
          rangerExportPolicyList = gson.fromJson(response, RangerExportPolicyList.class);
          return rangerExportPolicyList;
        }
      } else if (clientResp.getStatus() == HttpServletResponse.SC_NO_CONTENT) {
        LOG.debug("Ranger policy export request returned empty list");
        return rangerExportPolicyList;
      } else if (clientResp.getStatus() == HttpServletResponse.SC_UNAUTHORIZED) {
        throw new RuntimeException(ErrorMsg.RANGER_AUTHENTICATION_FAILED.getMsg());
      } else if (clientResp.getStatus() == HttpServletResponse.SC_FORBIDDEN) {
        throw new RuntimeException(ErrorMsg.RANGER_AUTHORIZATION_FAILED.getMsg());
      }
    }
    if (StringUtils.isEmpty(response)) {
      LOG.debug("Ranger policy export request returned empty list or failed, Please refer Ranger admin logs.");
    }
    return null;
  }
RangerRestClientImpl to connect to Ranger and export policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java