|
82 | 82 | import io.netty.channel.ChannelHandlerContext; |
83 | 83 | import io.netty.channel.ChannelOption; |
84 | 84 | import io.netty.channel.ChannelPromise; |
| 85 | +import io.netty.channel.DefaultEventLoopGroup; |
85 | 86 | import io.netty.channel.EventLoopGroup; |
86 | 87 | import io.netty.channel.ReflectiveChannelFactory; |
87 | 88 | import io.netty.channel.local.LocalChannel; |
@@ -519,15 +520,20 @@ public void channelFactoryShouldSetSocketOptionKeepAlive() throws Exception { |
519 | 520 | @Test |
520 | 521 | public void channelFactoryShouldNNotSetSocketOptionKeepAlive() throws Exception { |
521 | 522 | startServer(); |
522 | | - NettyClientTransport transport = newTransport(newNegotiator(), |
523 | | - DEFAULT_MAX_MESSAGE_SIZE, GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE, "testUserAgent", true, |
524 | | - TimeUnit.SECONDS.toNanos(10L), TimeUnit.SECONDS.toNanos(1L), |
525 | | - new ReflectiveChannelFactory<>(LocalChannel.class), group); |
| 523 | + DefaultEventLoopGroup group = new DefaultEventLoopGroup(1); |
| 524 | + try { |
| 525 | + NettyClientTransport transport = newTransport(newNegotiator(), |
| 526 | + DEFAULT_MAX_MESSAGE_SIZE, GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE, "testUserAgent", true, |
| 527 | + TimeUnit.SECONDS.toNanos(10L), TimeUnit.SECONDS.toNanos(1L), |
| 528 | + new ReflectiveChannelFactory<>(LocalChannel.class), group); |
526 | 529 |
|
527 | | - callMeMaybe(transport.start(clientTransportListener)); |
| 530 | + callMeMaybe(transport.start(clientTransportListener)); |
528 | 531 |
|
529 | | - assertThat(transport.channel().config().getOption(ChannelOption.SO_KEEPALIVE)) |
530 | | - .isNull(); |
| 532 | + assertThat(transport.channel().config().getOption(ChannelOption.SO_KEEPALIVE)) |
| 533 | + .isNull(); |
| 534 | + } finally { |
| 535 | + group.shutdownGracefully(0, 10, TimeUnit.SECONDS); |
| 536 | + } |
531 | 537 | } |
532 | 538 |
|
533 | 539 | @Test |
|
0 commit comments