@Test void healthyThenNotHealthyThenHealthy() {
    try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
      assertOk(storage.check());

      logger.info("setting server 1 and 2 unhealthy");
      server1Health.setHealthy(false);
      server2Health.setHealthy(false);

      awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isFalse());

      logger.info("setting server 1 healthy");
      server1Health.setHealthy(true);

      awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isTrue());
    }
  }
This ensures the response is sent after the request is fully read.
zipkin-server/src/test/java/zipkin2/server/internal/elasticsearch/ITElasticsearchHealthCheck.java