Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netty: Use DefaultELG with LocalChannel in test #11461

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions netty/src/test/java/io/grpc/netty/NettyClientTransportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
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;
Expand Down Expand Up @@ -519,15 +520,20 @@ public void channelFactoryShouldSetSocketOptionKeepAlive() throws Exception {
@Test
public void channelFactoryShouldNNotSetSocketOptionKeepAlive() throws Exception {
startServer();
NettyClientTransport transport = newTransport(newNegotiator(),
DEFAULT_MAX_MESSAGE_SIZE, GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE, "testUserAgent", true,
TimeUnit.SECONDS.toNanos(10L), TimeUnit.SECONDS.toNanos(1L),
new ReflectiveChannelFactory<>(LocalChannel.class), group);
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),
new ReflectiveChannelFactory<>(LocalChannel.class), group);

callMeMaybe(transport.start(clientTransportListener));
callMeMaybe(transport.start(clientTransportListener));

assertThat(transport.channel().config().getOption(ChannelOption.SO_KEEPALIVE))
.isNull();
assertThat(transport.channel().config().getOption(ChannelOption.SO_KEEPALIVE))
.isNull();
} finally {
group.shutdownGracefully(0, 10, TimeUnit.SECONDS);
}
}

@Test
Expand Down
Loading