This is an example of how Java non-blocking IO API (java.nio) can be used to build a basic chat server. Once running, it will bind to all the available interfaces and listen for connections on the TCP port 10000.
You can join the chat room with a Telnet client as follows.
telnet localhost 10000
mvn package
java -jar target/nio-chat-server-1.0-SNAPSHOT.jar