TEST_P(DownstreamProtocolIntegrationTest, TestPreconnect) {
  config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) {
    auto* cluster = bootstrap.mutable_static_resources()->mutable_clusters(0);
    cluster->mutable_preconnect_policy()->mutable_per_upstream_preconnect_ratio()->set_value(1.5);
  });
  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response =
      sendRequestAndWaitForResponse(default_request_headers_, 0, default_response_headers_, 0);
  FakeHttpConnectionPtr fake_upstream_connection_two;
  if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) {
    // For HTTP/1.1 there should be a preconnected connection.
    ASSERT_TRUE(
        fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_two));
  } else {
    // For HTTP/2, the original connection can accommodate two requests.
    ASSERT_FALSE(fake_upstreams_[0]->waitForHttpConnection(
        *dispatcher_, fake_upstream_connection_two, std::chrono::milliseconds(5)));
  }
}
TEST_P(DownstreamProtocolIntegrationTest, TestPreconnect) {
  config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) {
    auto* cluster = bootstrap.mutable_static_resources()->mutable_clusters(0);
    cluster->mutable_preconnect_policy()->mutable_per_upstream_preconnect_ratio()->set_value(1.5);
  });
  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response =
      sendRequestAndWaitForResponse(default_request_headers_, 0, default_response_headers_, 0);
  FakeHttpConnectionPtr fake_upstream_connection_two;
  if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) {
     
    ASSERT_TRUE(
        fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_two));
  } else {
     
    ASSERT_FALSE(fake_upstreams_[0]->waitForHttpConnection(
        *dispatcher_, fake_upstream_connection_two, std::chrono::milliseconds(5)));
  }
}