diff --git a/mobile/test/common/integration/test_server.cc b/mobile/test/common/integration/test_server.cc index 6106161fe486..069125fa8398 100644 --- a/mobile/test/common/integration/test_server.cc +++ b/mobile/test/common/integration/test_server.cc @@ -169,12 +169,16 @@ void TestServer::start(TestServerType type, int port) { break; case TestServerType::HTTP2_WITH_TLS: upstream_config_.upstream_protocol_ = Http::CodecType::HTTP2; - factory = createUpstreamTlsContext(factory_context_); + factory = createUpstreamTlsContext(factory_context_, /* add_alpn= */ true); break; case TestServerType::HTTP1_WITHOUT_TLS: upstream_config_.upstream_protocol_ = Http::CodecType::HTTP1; factory = Network::Test::createRawBufferDownstreamSocketFactory(); break; + case TestServerType::HTTP1_WITH_TLS: + upstream_config_.upstream_protocol_ = Http::CodecType::HTTP1; + factory = createUpstreamTlsContext(factory_context_, /* add_alpn= */ false); + break; case TestServerType::HTTP_PROXY: { Server::forceRegisterDefaultListenerManagerFactoryImpl(); Extensions::TransportSockets::RawBuffer::forceRegisterDownstreamRawBufferSocketFactory(); @@ -327,7 +331,8 @@ Network::DownstreamTransportSocketFactoryPtr TestServer::createQuicUpstreamTlsCo } Network::DownstreamTransportSocketFactoryPtr TestServer::createUpstreamTlsContext( - testing::NiceMock& factory_context) { + testing::NiceMock& factory_context, + bool add_alpn) { envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context; envoy::extensions::transport_sockets::tls::v3::TlsCertificate* certs = tls_context.mutable_common_tls_context()->add_tls_certificates(); @@ -338,7 +343,9 @@ Network::DownstreamTransportSocketFactoryPtr TestServer::createUpstreamTlsContex auto* ctx = tls_context.mutable_common_tls_context()->mutable_validation_context(); ctx->mutable_trusted_ca()->set_filename( TestEnvironment::runfilesPath("test/config/integration/certs/upstreamcacert.pem")); - tls_context.mutable_common_tls_context()->add_alpn_protocols("h2"); + if (add_alpn) { + tls_context.mutable_common_tls_context()->add_alpn_protocols("h2"); + } auto cfg = *Extensions::TransportSockets::Tls::ServerContextConfigImpl::create( tls_context, factory_context, false); static auto* upstream_stats_store = new Stats::TestIsolatedStoreImpl(); diff --git a/mobile/test/common/integration/test_server.h b/mobile/test/common/integration/test_server.h index c4156aa667b8..ecfa6f54df6d 100644 --- a/mobile/test/common/integration/test_server.h +++ b/mobile/test/common/integration/test_server.h @@ -18,10 +18,11 @@ namespace Envoy { enum class TestServerType : int { HTTP1_WITHOUT_TLS = 0, - HTTP2_WITH_TLS = 1, - HTTP3 = 2, - HTTP_PROXY = 3, - HTTPS_PROXY = 4, + HTTP1_WITH_TLS = 1, + HTTP2_WITH_TLS = 2, + HTTP3 = 3, + HTTP_PROXY = 4, + HTTPS_PROXY = 5, }; class TestServer : public ListenerHooks { @@ -92,7 +93,7 @@ class TestServer : public ListenerHooks { testing::NiceMock&); Network::DownstreamTransportSocketFactoryPtr createUpstreamTlsContext( - testing::NiceMock&); + testing::NiceMock&, bool); }; } // namespace Envoy diff --git a/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpProxyTestServerFactory.java b/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpProxyTestServerFactory.java index 1d3bb4fb393f..4b8811615609 100644 --- a/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpProxyTestServerFactory.java +++ b/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpProxyTestServerFactory.java @@ -4,8 +4,8 @@ public final class HttpProxyTestServerFactory { /** The supported {@link HttpProxyTestServer} types. */ public static class Type { - public static final int HTTP_PROXY = 3; - public static final int HTTPS_PROXY = 4; + public static final int HTTP_PROXY = 4; + public static final int HTTPS_PROXY = 5; private Type() {} } diff --git a/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpTestServerFactory.java b/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpTestServerFactory.java index ee4e7f84d5a5..2569e174553f 100644 --- a/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpTestServerFactory.java +++ b/mobile/test/java/io/envoyproxy/envoymobile/engine/testing/HttpTestServerFactory.java @@ -8,8 +8,9 @@ public final class HttpTestServerFactory { /** The supported {@link HttpTestServer} types. */ public static class Type { public static final int HTTP1_WITHOUT_TLS = 0; - public static final int HTTP2_WITH_TLS = 1; - public static final int HTTP3 = 2; + public static final int HTTP1_WITH_TLS = 1; + public static final int HTTP2_WITH_TLS = 2; + public static final int HTTP3 = 3; private Type() {} }