private void runTest()

in client/src/main/java/com/google/cloud/solutions/opencensus/client/JettyTestClient.java [67:98]


  private void runTest() {
    HttpClientFactory factory = testOptions.getHttpClientFactory();
    HttpClient httpClient = factory.getHttpClient();
    try {
      httpClient.start();
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Error starting HttpClient " + e.getMessage() + " exiting");
      System.exit(1);
    }

    String targetURL = testOptions.targetURL();
    LOGGER.info("Sending requests to " + targetURL);
    Function<Integer[], Integer> count = (numbers) -> numbers.length;
    Function<Integer[], Integer> sum =
        (numbers) -> Arrays.stream(numbers).mapToInt(Integer::intValue).sum();
    for (int i = 0; i < testOptions.nIterations(); i++) {
      try {
        prepareSendProcess(httpClient, HttpMethod.GET, count, "count");
        prepareSendProcess(httpClient, HttpMethod.POST, count, "count");
        prepareSendProcess(httpClient, HttpMethod.GET, sum, "sum");
        prepareSendProcess(httpClient, HttpMethod.POST, sum, "sum");
        Thread.sleep(100);
      } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Error: " + e.getMessage(), e);
      }
    }
    try {
      httpClient.stop();
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Error stopping HttpClient " + e.getMessage());
    }
  }