2121import com .google .common .collect .ImmutableList ;
2222import com .google .common .collect .ImmutableMap ;
2323import com .google .common .util .concurrent .SettableFuture ;
24+ import io .envoyproxy .envoy .config .core .v3 .SocketAddress .Protocol ;
2425import io .grpc .InsecureChannelCredentials ;
2526import io .grpc .MetricRecorder ;
2627import io .grpc .internal .ObjectPool ;
@@ -74,7 +75,7 @@ public class XdsServerTestHelper {
7475 static void generateListenerUpdate (FakeXdsClient xdsClient ,
7576 EnvoyServerProtoData .DownstreamTlsContext tlsContext ,
7677 TlsContextManager tlsContextManager ) {
77- EnvoyServerProtoData .Listener listener = buildTestListener ("listener1" , "10.1.2.3 " ,
78+ EnvoyServerProtoData .Listener listener = buildTestListener ("listener1" , "0.0.0.0:0 " ,
7879 ImmutableList .of (), tlsContext , null , tlsContextManager );
7980 LdsUpdate listenerUpdate = LdsUpdate .forTcpListener (listener );
8081 xdsClient .deliverLdsUpdate (listenerUpdate );
@@ -85,7 +86,8 @@ static void generateListenerUpdate(
8586 EnvoyServerProtoData .DownstreamTlsContext tlsContext ,
8687 EnvoyServerProtoData .DownstreamTlsContext tlsContextForDefaultFilterChain ,
8788 TlsContextManager tlsContextManager ) {
88- EnvoyServerProtoData .Listener listener = buildTestListener ("listener1" , "10.1.2.3" , sourcePorts ,
89+ EnvoyServerProtoData .Listener listener = buildTestListener (
90+ "listener1" , "0.0.0.0:7000" , sourcePorts ,
8991 tlsContext , tlsContextForDefaultFilterChain , tlsContextManager );
9092 LdsUpdate listenerUpdate = LdsUpdate .forTcpListener (listener );
9193 xdsClient .deliverLdsUpdate (listenerUpdate );
@@ -130,7 +132,7 @@ static EnvoyServerProtoData.Listener buildTestListener(
130132 tlsContextForDefaultFilterChain , tlsContextManager );
131133 EnvoyServerProtoData .Listener listener =
132134 EnvoyServerProtoData .Listener .create (
133- name , address , ImmutableList .of (filterChain1 ), defaultFilterChain );
135+ name , address , ImmutableList .of (filterChain1 ), defaultFilterChain , Protocol . TCP );
134136 return listener ;
135137 }
136138
@@ -290,15 +292,23 @@ private String awaitLdsResource(Duration timeout) {
290292 }
291293 }
292294
295+ void deliverLdsUpdateWithApiListener (long httpMaxStreamDurationNano ,
296+ List <VirtualHost > virtualHosts ) {
297+ execute (() -> {
298+ ldsWatcher .onChanged (LdsUpdate .forApiListener (HttpConnectionManager .forVirtualHosts (
299+ httpMaxStreamDurationNano , virtualHosts , null )));
300+ });
301+ }
302+
293303 void deliverLdsUpdate (LdsUpdate ldsUpdate ) {
294304 execute (() -> ldsWatcher .onChanged (ldsUpdate ));
295305 }
296306
297307 void deliverLdsUpdate (
298308 List <FilterChain > filterChains ,
299309 @ Nullable FilterChain defaultFilterChain ) {
300- deliverLdsUpdate (LdsUpdate .forTcpListener (Listener .create (
301- "listener" , "0.0.0.0:1" , ImmutableList .copyOf (filterChains ), defaultFilterChain )));
310+ deliverLdsUpdate (LdsUpdate .forTcpListener (Listener .create ("listener" , "0.0.0.0:1" ,
311+ ImmutableList .copyOf (filterChains ), defaultFilterChain , Protocol . TCP )));
302312 }
303313
304314 void deliverLdsUpdate (FilterChain filterChain , @ Nullable FilterChain defaultFilterChain ) {
0 commit comments