public void run() {
        Console.log("[UDP] sender started.");
        try {
            int sendCounter = 0;
            while (!done) {
                selector.select(60000); // important property!
                Set<SelectionKey> keys = selector.selectedKeys();
                Iterator<SelectionKey> iter = keys.iterator();
                while (iter.hasNext()) {
                    SelectionKey key = iter.next();
                    iter.remove();
                    if (key.isWritable()) {
                        send(settings.getPacketSize());
                        sendCounter++;
                    }
                }
                if (sendCounter == settings.getPacketsQuantity()) {
                    Console.log("[UDP] " + sendCounter + " packets sended");
                    shutDown();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        Console.log("[UDP] sender stopped.");
    }