I built a simple pipeline for serving HTTP/1.1 content with Netty, and I'm looking to see how I can convert it to HTTP/2. I see various classes for converting between frames and negotiating, but I can't figure out how to assemble them into a pipeline. The following code is in Kotlin. The main issue I have is with ALPN negotiation, and also converting the frames right in both directions.
val bootstrap = ServerBootstrap()
bootstrap.group(transport.bossGroup, transport.workerGroup)
.channelFactory(transport.factory)
.childHandler(object : ChannelInitializer<SocketChannel>() {
public override fun initChannel(ch: SocketChannel) {
ch.pipeline().addLast("ssl", sslContext.newHandler(ch.alloc()))
ch.pipeline().addLast("codec", HttpServerCodec())
ch.pipeline().addLast("keepAlive", HttpServerKeepAliveHandler())
ch.pipeline().addLast("aggregator", HttpObjectAggregator(65536))
ch.pipeline().addLast("burstLimiter", burstLimiter)
ch.pipeline().addLast(
"readTimeoutHandler",
ReadTimeoutHandler(60)
)
ch.pipeline().addLast(
"writeTimeoutHandler",
WriteTimeoutHandler(60)
)
ch.pipeline().addLast("streamer", ChunkedWriteHandler())
ch.pipeline().addLast("handler", CustomHandler(httpHandler))
}
})