File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
xds/src/test/java/io/grpc/xds/internal/grpcservice Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -135,4 +135,29 @@ public void getChannel_afterClose_throwsException() {
135135 assertThat (e ).hasMessageThat ().contains ("CachedChannelManager is closed" );
136136 }
137137 }
138+
139+ @ Test
140+ public void constructor_defaultCreatesChannel () {
141+ CachedChannelManager defaultManager = new CachedChannelManager ();
142+ io .grpc .ChannelCredentials creds = io .grpc .InsecureChannelCredentials .create ();
143+ ChannelCredsConfig credsConfig = mock (ChannelCredsConfig .class );
144+ when (credsConfig .type ()).thenReturn ("insecure" );
145+ ConfiguredChannelCredentials configuredCreds =
146+ ConfiguredChannelCredentials .create (creds , credsConfig );
147+ GoogleGrpcConfig googleGrpc = GoogleGrpcConfig .builder ()
148+ .target ("localhost:8080" )
149+ .configuredChannelCredentials (configuredCreds )
150+ .build ();
151+ GrpcServiceConfig config = GrpcServiceConfig .builder ()
152+ .googleGrpc (googleGrpc )
153+ .initialMetadata (ImmutableList .of ())
154+ .build ();
155+
156+ ManagedChannel channel = defaultManager .getChannel (config );
157+ assertThat (channel ).isNotNull ();
158+
159+ channel .shutdownNow ();
160+ defaultManager .close ();
161+ }
162+
138163}
You can’t perform that action at this time.
0 commit comments