@Override
    public void run() {
         while (isAlive) {
            try {
                String inputLine = inStream.readLine();
                if (inputLine == null) {
                    this.isAlive = false;
                    break;
                }
                switch (collectState) {
                    case 0:
                        this.exec(inputLine);
                        break;
                    case 1:
                        synchronized (collectLock) {
                            collectBuf.append(inputLine);
                            collectState = 0;
                            collectLock.notify();
                        }
                        break;
                    case 2:
                        synchronized (collectLock) {
                            if (!inputLine.startsWith("END:")) {
                                collectBuf.append(inputLine + "\n");
                                if (inputLine.startsWith("RIBBON_ERROR:")) {
                                    collectState = 0;
                                    collectLock.notify();
                                }
                            } else {
                                collectState = 0;
                                collectLock.notify();
                            }
                        }
                }
            } catch (java.io.IOException ex) {
                currentApplication.log(1, "Неможливо зчитати дані з сокету!");
                isAlive = false;
            }
        }
    }