Learning Netty - HTTP Echo

Published 2016-01-19 on Farid Zakaria's Blog

Learning Netty - Part 1

I recently picked up a copy of Netty in Action - which has been a great to learn more about Netty. I've become more fascinated with Netty as I've delved farther into Reactive & Asynchronous programming. Netty is a very powerful framework that simplifies a lot of the challenges with NIO programming however it is still difficult to find resources / examples of every day use cases.

Echo HTTP

Many examples online start with building an Echo Server & Client. However they use a simple TCP echo server - which although probably more reasonable for the server doesn't show a barebones HTTP setup.

The following is a Gist of a barebones setup of setting up an HTTP server and client. The example shows a few simple defaults such as the use of HttpObjectAggregator, HttpServerCodec and SimpleChannelInboundHandler.