void HttpConnectionManagerImplTest::setup(bool ssl, const std::string& server_name, bool tracing,
                                          bool use_srds) {
  use_srds_ = use_srds;
  if (ssl) {
    ssl_connection_ = std::make_shared<Ssl::MockConnectionInfo>();
  }

  server_name_ = server_name;
  ON_CALL(filter_callbacks_.connection_, ssl()).WillByDefault(Return(ssl_connection_));
  ON_CALL(Const(filter_callbacks_.connection_), ssl()).WillByDefault(Return(ssl_connection_));
  ON_CALL(filter_callbacks_.connection_.dispatcher_, createScaledTypedTimer_)
      .WillByDefault([&](auto, auto callback) {
        return filter_callbacks_.connection_.dispatcher_.createTimer(callback).release();
      });
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_->setLocalAddress(
      std::make_shared<Network::Address::Ipv4Instance>("127.0.0.1", 443));
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_->setRemoteAddress(
      std::make_shared<Network::Address::Ipv4Instance>("0.0.0.0"));
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_
      ->setDirectRemoteAddressForTest(std::make_shared<Network::Address::Ipv4Instance>("0.0.0.0"));
  conn_manager_ = std::make_unique<ConnectionManagerImpl>(
      *this, drain_close_, random_, http_context_, runtime_, local_info_, cluster_manager_,
      overload_manager_, test_time_.timeSystem());
  conn_manager_->initializeReadFilterCallbacks(filter_callbacks_);

  if (tracing) {
    envoy::type::v3::FractionalPercent percent1;
    percent1.set_numerator(100);
    envoy::type::v3::FractionalPercent percent2;
    percent2.set_numerator(10000);
    percent2.set_denominator(envoy::type::v3::FractionalPercent::TEN_THOUSAND);
    tracing_config_ = std::make_unique<TracingConnectionManagerConfig>(
        TracingConnectionManagerConfig{Tracing::OperationName::Ingress,
                                       {{":method", requestHeaderCustomTag(":method")}},
                                       percent1,
                                       percent2,
                                       percent1,
                                       false,
                                       256});
  }
}
void HttpConnectionManagerImplTest::setup(bool ssl, const std::string& server_name, bool tracing,
                                          bool use_srds) {
  use_srds_ = use_srds;
  if (ssl) {
    ssl_connection_ = std::make_shared<Ssl::MockConnectionInfo>();
  }

  server_name_ = server_name;
  ON_CALL(filter_callbacks_.connection_, ssl()).WillByDefault(Return(ssl_connection_));
  ON_CALL(Const(filter_callbacks_.connection_), ssl()).WillByDefault(Return(ssl_connection_));
  ON_CALL(filter_callbacks_.connection_.dispatcher_, createScaledTypedTimer_)
      .WillByDefault([&](auto, auto callback) {
        return filter_callbacks_.connection_.dispatcher_.createTimer(callback).release();
      });
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_->setLocalAddress(
      std::make_shared<Network::Address::Ipv4Instance>("127.0.0.1", 443));
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_->setRemoteAddress(
      std::make_shared<Network::Address::Ipv4Instance>("0.0.0.0"));
  filter_callbacks_.connection_.stream_info_.downstream_address_provider_
      ->setDirectRemoteAddressForTest(std::make_shared<Network::Address::Ipv4Instance>("0.0.0.0"));
  conn_manager_ = std::make_unique<ConnectionManagerImpl>(
      *this, drain_close_, random_, http_context_, runtime_, local_info_, cluster_manager_,
      overload_manager_, test_time_.timeSystem());
  conn_manager_->initializeReadFilterCallbacks(filter_callbacks_);

  if (tracing) {
    envoy::type::v3::FractionalPercent percent1;
    percent1.set_numerator(100);
    envoy::type::v3::FractionalPercent percent2;
    percent2.set_numerator(10000);
    percent2.set_denominator(envoy::type::v3::FractionalPercent::TEN_THOUSAND);
    tracing_config_ = std::make_unique<TracingConnectionManagerConfig>(
        TracingConnectionManagerConfig{Tracing::OperationName::Ingress,
                                       {{":method", requestHeaderCustomTag(":method")}},
                                       percent1,
                                       percent2,
                                       percent1,
                                       false,
                                       256});
  }
}