diff --git a/test/common/http/http2/codec_impl_test.cc b/test/common/http/http2/codec_impl_test.cc index 39564183c358..3daec9a7d43f 100644 --- a/test/common/http/http2/codec_impl_test.cc +++ b/test/common/http/http2/codec_impl_test.cc @@ -363,14 +363,8 @@ TEST_P(Http2CodecImplTest, ProtocolErrorForTest) { // We have to dynamic cast because protocolErrorForTest() is intentionally not on the // Connection API. ServerConnectionImpl* raw_server = dynamic_cast(server_.get()); - if (raw_server != nullptr) { - EXPECT_EQ(StatusCode::CodecProtocolError, getStatusCode(raw_server->protocolErrorForTest())); - } else { - Envoy::Http::Legacy::Http2::ServerConnectionImpl* legacy_raw_server = - dynamic_cast(server_.get()); - ASSERT(legacy_raw_server != nullptr); - legacy_raw_server->protocolErrorForTest(); - } + ASSERT(raw_server != nullptr); + EXPECT_EQ(StatusCode::CodecProtocolError, getStatusCode(raw_server->protocolErrorForTest())); } // 100 response followed by 200 results in a [decode100ContinueHeaders, decodeHeaders] sequence. diff --git a/test/integration/fake_upstream.cc b/test/integration/fake_upstream.cc index 5539af1366df..c287fe11621b 100644 --- a/test/integration/fake_upstream.cc +++ b/test/integration/fake_upstream.cc @@ -388,22 +388,11 @@ void FakeHttpConnection::encodeProtocolError() { Http::Http2::ServerConnectionImpl* codec = dynamic_cast(codec_.get()); - if (codec != nullptr) { - shared_connection_.connection().dispatcher().post([codec]() { - Http::Status status = codec->protocolErrorForTest(); - ASSERT(Http::getStatusCode(status) == Http::StatusCode::CodecProtocolError); - }); - } else { - // Fall back to trying the Legacy ServerConnectionImpl which is used in certain test - // configurations, specifically the bazel.compile_time_options tests. - // TODO(mpuncel) remove this "else" case when the legacy codec is no longer used. - Http::Legacy::Http2::ServerConnectionImpl* legacy_codec = - dynamic_cast(codec_.get()); - ASSERT(legacy_codec != nullptr); - - shared_connection_.connection().dispatcher().post( - [legacy_codec]() { legacy_codec->protocolErrorForTest(); }); - } + ASSERT(codec != nullptr); + shared_connection_.connection().dispatcher().post([codec]() { + Http::Status status = codec->protocolErrorForTest(); + ASSERT(Http::getStatusCode(status) == Http::StatusCode::CodecProtocolError); + }); } AssertionResult FakeConnectionBase::waitForDisconnect(milliseconds timeout) {