Java NIO server example

Apr 1, 2021

Recently I decided to build a simple http server on top of Java NIO in order to better understand the technology. As a result, I want to share what I've got. This is a simple server that responds with a 418 status to any requests.

Server does all the processing in the one main thread and uses blocking logger from java.util.logging package.

How to start

You can find the code here TeapotHttpServer. First of all you need to compile class:javac TeapotHttpServer.javaand then just run:java TeapotHttpServerServer will be available at http://localhost:8080

418 I’m teapot page