private void finalCleanUp() {
        Iterator<SelectionKey> iter = selector.keys().iterator();
        while (iter.hasNext()) {
            SelectionKey key = iter.next();
            try {
                key.channel().close();
            } catch (IOException e) {
                logger.info("An IOException happened while closing a channel: " + key.channel().toString());
            }
        }

        try {
            selector.close();
        } catch (IOException e) {
            logger.info("An IOException happened while closing a selector");
        }
    }