@SuppressWarnings("empty-statement")
    @Override
    public void run() {

        while (true) {

            try {
                synchronized (guard) { };
                
                if (sel.select() <= 0) {
                    continue;
                }
            } catch (IOException e) {
                continue;
            }

            synchronized(guard) {
            for (SelectionKey k : sel.selectedKeys()) {
                if (k.isValid() && (k.attachment() != null)) {
                    final AbstractSelectableChannelConnection conn = (AbstractSelectableChannelConnection) k.attachment();
                    
                    Event e;
                    if (k.isReadable()) {
                        e = new Event(Event.EVENT_READ, conn);
                    } else if (k.isWritable()) {
                        e = new Event(Event.EVENT_WRITE, conn);
                    } else {
                        continue;
                    }

                    removeConnection(conn);
                    conn.handleEvent(e);
                }
            }
            }

            sel.selectedKeys().clear();
        }
    }