TEST_P(DownstreamProtocolIntegrationTest, ConnectStreamRejection) {
  // TODO(danzh) add "allow_connect" to http3 options.
  EXCLUDE_DOWNSTREAM_HTTP3;
  if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) {
    return;
  }
  config_helper_.addConfigModifier(
      [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
             hcm) -> void {
        hcm.mutable_http3_protocol_options()
            ->mutable_override_stream_error_on_invalid_http_message()
            ->set_value(true);
        hcm.mutable_http2_protocol_options()
            ->mutable_override_stream_error_on_invalid_http_message()
            ->set_value(true);
      });

  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response = codec_client_->makeHeaderOnlyRequest(Http::TestRequestHeaderMapImpl{
      {":method", "CONNECT"}, {":path", "/"}, {":authority", "host"}});

  ASSERT_TRUE(response->waitForReset());
  EXPECT_FALSE(codec_client_->disconnected());
}
TEST_P(DownstreamProtocolIntegrationTest, ConnectStreamRejection) {
   
  EXCLUDE_DOWNSTREAM_HTTP3;
  if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) {
    return;
  }
  config_helper_.addConfigModifier(
      [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
             hcm) -> void {
        hcm.mutable_http3_protocol_options()
            ->mutable_override_stream_error_on_invalid_http_message()
            ->set_value(true);
        hcm.mutable_http2_protocol_options()
            ->mutable_override_stream_error_on_invalid_http_message()
            ->set_value(true);
      });

  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response = codec_client_->makeHeaderOnlyRequest(Http::TestRequestHeaderMapImpl{
      {":method", "CONNECT"}, {":path", "/"}, {":authority", "host"}});

  ASSERT_TRUE(response->waitForReset());
  EXPECT_FALSE(codec_client_->disconnected());
}