@Override public void run() { System.out.println("Shutting down..."); // create an exit thread that forces a shutdown if the JVM wont exit cleanly SystemExit exit = new SystemExit(5000); exit.setDaemon(true); exit.start(); try { // stop the channel channel.stop(Channel.DEFAULT); } catch (Exception x) { x.printStackTrace(); } System.out.println("Channel stopped."); }