Skip to content

Commit acfc511

Browse files
committed
Tests
1 parent b64f5d3 commit acfc511

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/internal/AwaitCloseChannelPoolMapTest.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,42 @@ public void usesProvidedKeyManagersProvider() {
268268
verify(provider).keyManagers();
269269
}
270270

271+
@Test
272+
public void acquireChannel_autoReadDisabled() {
273+
channelPoolMap = AwaitCloseChannelPoolMap.builder()
274+
.sdkChannelOptions(new SdkChannelOptions())
275+
.sdkEventLoopGroup(SdkEventLoopGroup.builder().build())
276+
.configuration(new NettyConfiguration(GLOBAL_HTTP_DEFAULTS))
277+
.protocol(Protocol.HTTP1_1)
278+
.maxStreams(100)
279+
.sslProvider(SslProvider.OPENSSL)
280+
.build();
281+
282+
ChannelPool channelPool = channelPoolMap.newPool(URI.create("https://localhost:" + mockProxy.port()));
283+
284+
Channel channel = channelPool.acquire().awaitUninterruptibly().getNow();
285+
286+
assertThat(channel.config().isAutoRead()).isFalse();
287+
}
288+
289+
@Test
290+
public void releaseChannel_autoReadEnabled() {
291+
channelPoolMap = AwaitCloseChannelPoolMap.builder()
292+
.sdkChannelOptions(new SdkChannelOptions())
293+
.sdkEventLoopGroup(SdkEventLoopGroup.builder().build())
294+
.configuration(new NettyConfiguration(GLOBAL_HTTP_DEFAULTS))
295+
.protocol(Protocol.HTTP1_1)
296+
.maxStreams(100)
297+
.sslProvider(SslProvider.OPENSSL)
298+
.build();
299+
300+
ChannelPool channelPool = channelPoolMap.newPool(URI.create("https://localhost:" + mockProxy.port()));
301+
302+
Channel channel = channelPool.acquire().awaitUninterruptibly().getNow();
303+
304+
channelPool.release(channel).awaitUninterruptibly();
305+
306+
assertThat(channel.config().isAutoRead()).isTrue();
307+
}
308+
271309
}

0 commit comments

Comments
 (0)