diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/net/PooledH2ConnectionFactoryTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/net/PooledH2ConnectionFactoryTest.java index 6f9b2bf37..9bc106244 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/net/PooledH2ConnectionFactoryTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/net/PooledH2ConnectionFactoryTest.java @@ -203,16 +203,18 @@ class PooledH2ConnectionFactoryTest { /// A future that completes once the factory has seen a GOAWAY on `connection` private static CompletableFuture goAwayRead(final Channel connection) { final CompletableFuture goAwayRead = new CompletableFuture<>(); - connection.pipeline().addAfter(connection.pipeline().context(Http2MultiplexHandler.class).name(), null, - new ChannelInboundHandlerAdapter() { - @Override - public void channelRead(final ChannelHandlerContext ctx, final Object msg) { - ctx.fireChannelRead(msg); - if (msg instanceof Http2GoAwayFrame) { - goAwayRead.complete(null); - } - } - }); + connection.eventLoop().submit(() -> connection.pipeline() + .addAfter(connection.pipeline().context(Http2MultiplexHandler.class).name(), null, + new ChannelInboundHandlerAdapter() { + @Override + public void channelRead(final ChannelHandlerContext ctx, final Object msg) { + ctx.fireChannelRead(msg); + if (msg instanceof Http2GoAwayFrame) { + goAwayRead.complete(null); + } + } + })) + .syncUninterruptibly(); return goAwayRead; } }