Skip to content

Commit

Permalink
changes requested
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymansfield committed Dec 18, 2024
1 parent dd18b8c commit 27eef58
Showing 1 changed file with 13 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@
import java.security.spec.MGF1ParameterSpec;
import java.security.spec.PSSParameterSpec;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
Expand Down Expand Up @@ -760,7 +756,6 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
readLatch.countDown();

ctx.close();
ctx.channel().parent().close();
} finally {
buffer.release();
}
Expand All @@ -787,11 +782,12 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
.get();
quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
new ChannelInboundHandlerAdapter()).addListener(f -> {
assertTrue(f.isSuccess());
Channel stream = (Channel) f.getNow();
stream.writeAndFlush(stream.alloc().buffer().writeInt(5));

}).await().addListener(f -> {
assertTrue(f.isSuccess());
});

readLatch.await();
} finally {
server.close().sync();
Expand All @@ -817,30 +813,8 @@ public void testKeyTypeChangeFail(Executor executor) throws Throwable {
.option(BoringSSLContextOption.SERVER_KEY_TYPES, serverKeyTypes)
.earlyData(true)
.build()),
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public boolean isSharable() {
return true;
}
}, new ChannelInboundHandlerAdapter() {
@Override
public boolean isSharable() {
return true;
}

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ByteBuf buffer = (ByteBuf) msg;
try {
fail("Should not reach here");

ctx.close();
ctx.channel().parent().close();
} finally {
buffer.release();
}
}
});
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter(),
new ChannelInboundHandlerAdapter());

InetSocketAddress address = (InetSocketAddress) server.localAddress();

Expand All @@ -855,19 +829,13 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
.sslEngineProvider(q -> sslContext.newEngine(q.alloc(), "localhost", 9999)));

try {
QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.get();
quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
new ChannelInboundHandlerAdapter()).addListener(f -> {
assertFalse(f.isSuccess());

}).await();
fail("Should not reach here");
} catch(Exception e) {
// This is expected as certificate/key is not specified type
assertThrows(ExecutionException.class, ()->{
QuicTestUtils.newQuicChannelBootstrap(channel)
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.get();
});
} finally {
server.close().sync();
channel.close().sync();
Expand Down

0 comments on commit 27eef58

Please sign in to comment.