code: private void fetchResultBatchWithRetry(RecordSetList<JsonElement> rs)
        throws AsyncApiException, DataRecordException, IOException {
      boolean success = false;
      int retryCount = 0;
      int recordCountBeforeFetch = this.bulkRecordCount;
  
      do {
        try {
          // reinitialize the reader to establish a new connection to handle transient network errors
          if (retryCount > 0) {
            reinitializeBufferedReader();
          }
  
          // on retries there may already be records in rs, so pass the number of records as the initial count
          fetchResultBatch(rs, this.bulkRecordCount - recordCountBeforeFetch);
          success = true;
        } catch (IOException e) {
          if (retryCount < this.fetchRetryLimit) {
            log.info("Exception while fetching data, retrying: " + e.getMessage(), e);
            retryCount++;
          } else {
            log.error("Exception while fetching data: " + e.getMessage(), e);
            throw e;
          }
        }
      } while (!success);
    }
docs: Fetch a result batch with retry for network errors
  @param rs the {@link RecordSetList} to fetch into