You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importio.netty.bootstrap.Bootstrapimportio.netty.channel.ChannelHandlerContextimportio.netty.channel.nio.NioEventLoopGroupimportio.netty.channel.socket.nio.NioDatagramChannelimportio.netty.handler.ssl.util.InsecureTrustManagerFactoryimportio.netty.incubator.codec.http3.*importio.netty.incubator.codec.quic.*importio.netty.util.ReferenceCountUtilimportjava.net.InetSocketAddressimportjava.util.concurrent.TimeUnitobject JS5ProxyServer {
@JvmStatic
funmain(args:Array<String>) {
val hostName ="areos.io"val js5Port =443val group =NioEventLoopGroup(1)
try {
val context =QuicSslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.applicationProtocols(*Http3.supportedApplicationProtocols())
.build()
val codec =Http3.newQuicClientCodecBuilder()
.sslContext(context)
.initialMaxStreamsBidirectional(100)
.initialMaxStreamsUnidirectional(100)
.initialMaxData(10000000)
.initialMaxStreamDataBidirectionalLocal(1000000)
.initialMaxStreamDataBidirectionalRemote(1000000)
.initialMaxStreamDataUnidirectional(1000000)
.maxIdleTimeout(5000, TimeUnit.MILLISECONDS)
.build()
val bs =Bootstrap()
val channel = bs.group(group)
.channel(NioDatagramChannel::class.java)
.handler(codec)
.bind(0)
.sync()
.channel()
val quicChannel =QuicChannel.newBootstrap(channel)
.handler(Http3ClientConnectionHandler())
.remoteAddress(InetSocketAddress(hostName, js5Port))
.option(
QuicChannelOption.QLOG,
QLogConfiguration("quiclog.txt", "testTitle", "test")
)
.connect()
.get()
val streamChannel =Http3.newRequestStream(quicChannel,
object:Http3RequestStreamInboundHandler() {
overridefunchannelRead(ctx:ChannelHandlerContext, frame:Http3HeadersFrame) {
println("header frame: $frame")
ReferenceCountUtil.release(frame)
}
overridefunchannelRead(ctx:ChannelHandlerContext, frame:Http3DataFrame) {
println("data frame: $frame")
ReferenceCountUtil.release(frame)
}
overridefunchannelInputClosed(ctx:ChannelHandlerContext) {
println("channel input closed")
ctx.close()
}
}).sync().now
streamChannel
.pipeline()
.addLast(
Http3FrameToHttpObjectCodec(false, false)
)
val headers =DefaultHttp3Headers(false)
.method("GET")
.path("/flat-cache/0-0.dat")
.authority("$hostName:$js5Port")
.scheme("https")
val headersFrame =DefaultHttp3HeadersFrame(headers)
streamChannel.writeAndFlush(headersFrame)
.addListener(QuicStreamChannel.SHUTDOWN_OUTPUT).sync()
// Wait for the stream channel and quic channel to be closed (this will happen after we received the FIN).// After this is done we will close the underlying datagram channel.
streamChannel.closeFuture().sync()
// After we received the response lets also close the underlying QUIC channel and datagram channel.
quicChannel.close().sync()
channel.close().sync()
} finally {
group.shutdownGracefully()
}
}
}
The text was updated successfully, but these errors were encountered:
Unfortunately I have no windows installation to test this with. That said I wonder if you need to set the correct hostname when creating the SSlEngine:
qlog
Reproduce with this on Windows x64:
The text was updated successfully, but these errors were encountered: