private static HttpResponse<String> trySend(HttpClient client, HttpRequest request, int retryCounter) throws IOException, StatsResponseException {
    try {
      HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
      if (CAN_RETRY_CODES.contains(response.statusCode()) && retryCounter < MAX_RETRIES) {
        Thread.sleep(RETRY_INTERVAL);
        response = trySend(client, request, ++retryCounter);
      }
      return response;
    }
    catch (InterruptedException | SecurityException e) {
      throw new StatsResponseException(e);
    }
  }
private static HttpResponse<String> trySend(HttpClient client, HttpRequest request, int retryCounter)