netty: Use DefaultELG with LocalChannel in test

LocalChannel is not guaranteed to be compatible with NioEventLoopGroup,
and is failing with Netty 4.2.0.Alpha3-SNAPSHOT.

See #11447
This commit is contained in:
Eric Anderson 2024-08-09 16:21:19 -07:00
parent 0d47f5bd1b
commit 4ab34229fb
1 changed files with 13 additions and 7 deletions

View File

@ -82,6 +82,7 @@ import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPromise;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.ReflectiveChannelFactory;
import io.netty.channel.local.LocalChannel;
@ -519,6 +520,8 @@ public class NettyClientTransportTest {
@Test
public void channelFactoryShouldNNotSetSocketOptionKeepAlive() throws Exception {
startServer();
DefaultEventLoopGroup group = new DefaultEventLoopGroup(1);
try {
NettyClientTransport transport = newTransport(newNegotiator(),
DEFAULT_MAX_MESSAGE_SIZE, GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE, "testUserAgent", true,
TimeUnit.SECONDS.toNanos(10L), TimeUnit.SECONDS.toNanos(1L),
@ -528,6 +531,9 @@ public class NettyClientTransportTest {
assertThat(transport.channel().config().getOption(ChannelOption.SO_KEEPALIVE))
.isNull();
} finally {
group.shutdownGracefully(0, 10, TimeUnit.SECONDS);
}
}
@Test