TEST_F(ConnectionManagerUtilityTest, PreserveForwardedProtoWhenInternalButSetScheme) {
  TestScopedRuntime scoped_runtime;

  ON_CALL(config_, useRemoteAddress()).WillByDefault(Return(true));
  ON_CALL(config_, xffNumTrustedHops()).WillByDefault(Return(1));
  EXPECT_CALL(config_, skipXffAppend()).WillOnce(Return(true));
  connection_.stream_info_.downstream_address_provider_->setRemoteAddress(
      std::make_shared<Network::Address::Ipv4Instance>("12.12.12.12"));
  ON_CALL(config_, useRemoteAddress()).WillByDefault(Return(true));
  TestRequestHeaderMapImpl headers{{"x-forwarded-proto", "foo"}};

  callMutateRequestHeaders(headers, Protocol::Http2);
  EXPECT_EQ("foo", headers.getForwardedProtoValue());
  // Given :scheme was not set, but X-Forwarded-Proto is not a valid scheme,
  // scheme will be set based on encryption level.
  EXPECT_EQ("http", headers.getSchemeValue());
}
TEST_F(ConnectionManagerUtilityTest, PreserveForwardedProtoWhenInternalButSetScheme) {
  TestScopedRuntime scoped_runtime;

  ON_CALL(config_, useRemoteAddress()).WillByDefault(Return(true));
  ON_CALL(config_, xffNumTrustedHops()).WillByDefault(Return(1));
  EXPECT_CALL(config_, skipXffAppend()).WillOnce(Return(true));
  connection_.stream_info_.downstream_address_provider_->setRemoteAddress(
      std::make_shared<Network::Address::Ipv4Instance>("12.12.12.12"));
  ON_CALL(config_, useRemoteAddress()).WillByDefault(Return(true));
  TestRequestHeaderMapImpl headers{{"x-forwarded-proto", "foo"}};

  callMutateRequestHeaders(headers, Protocol::Http2);
  EXPECT_EQ("foo", headers.getForwardedProtoValue());
   
   
  EXPECT_EQ("http", headers.getSchemeValue());
}