public void run()

in src/main/java/org/apache/sling/maven/slingstart/run/ControlListener.java [83:134]


    public void run() {
        final InetSocketAddress socketAddress = getSocketAddress(this.port);
        try {
            server = new ServerSocket();
            server.bind(socketAddress);
        } catch (final IOException ioe) {
            return;
        }

        try {
            while (!stopped) {

                final Socket s = server.accept();

                try {
                    final String commandLine = readLine(s);
                    if (commandLine == null) {
                        final String msg = "ERR: missing command";
                        writeLine(s, msg);
                        continue;
                    }

                    final String command = commandLine;

                    if (COMMAND_STARTED.equals(command)) {
                        writeLine(s, RESPONSE_OK);
                        this.started = true;
                        this.stopped = true;
                        break;

                    } else {
                        final String msg = "ERR:" + command;
                        writeLine(s, msg);

                    }
                } finally {
                    try {
                        s.close();
                    } catch (IOException ignore) {
                    }
                }
            }
        } catch (final IOException ioe) {
            // ignore
        } finally {
            try {
                server.close();
            } catch (final IOException ignore) {
                // ignore
            }
        }
    }