// Path: control/src/main/java/org/kaazing/k3po/control/internal/command/CloseCommand.java
// public final class CloseCommand extends Command {
// 
//     @Override
//     public Kind getKind() {
//         return Kind.CLOSE;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(getKind());
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         return o == this || o instanceof CloseCommand && equalTo((CloseCommand) o);
//     }
// 
// }
// 
// Path: control/src/main/java/org/kaazing/k3po/control/internal/command/Command.java
// public abstract class Command {
// 
//     /**
//      * Kind of Command.
//      *
//      */
//     public enum Kind {
//         /**
//          * Prepare command.
//          */
//         PREPARE,
//         /**
//          * Start command.
//          */
//         START,
//         /**
//          * Abort command.
//          */
//         ABORT,
//         /**
//          * Await command.
//          */
//         AWAIT,
//         /**
//          * Notify command.
//          */
//         NOTIFY,
//         /**
//          * Close command.
//          */
//         CLOSE
//     }
// 
//     /**
//      * @return Kind
//      */
//     public abstract Kind getKind();
// 
//     @Override
//     public abstract int hashCode();
// 
//     @Override
//     public boolean equals(Object o) {
//         return o == this || o instanceof Command && equalTo((Command) o);
//     }
// 
//     protected final boolean equalTo(Command that) {
//         return Objects.equals(this.getKind(), that.getKind());
//     }
// 
// }


import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.kaazing.k3po.control.internal.command.AbortCommand;
import org.kaazing.k3po.control.internal.command.AwaitCommand;
import org.kaazing.k3po.control.internal.command.CloseCommand;
import org.kaazing.k3po.control.internal.command.Command;
import org.kaazing.k3po.control.internal.command.NotifyCommand;
import org.kaazing.k3po.control.internal.command.PrepareCommand;
import org.kaazing.k3po.control.internal.command.StartCommand;
import org.kaazing.k3po.control.internal.event.CommandEvent;
import org.kaazing.k3po.control.internal.event.ErrorEvent;
import org.kaazing.k3po.control.internal.event.FinishedEvent;
import org.kaazing.k3po.control.internal.event.NotifiedEvent;
import org.kaazing.k3po.control.internal.event.PreparedEvent;
import org.kaazing.k3po.control.internal.event.StartedEvent;
        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("ABORT\n");
        textOut.append("\n");
        textOut.flush();
    }

    private void writeCommand(NotifyCommand notify) throws IOException, CharacterCodingException {
        OutputStream bytesOut = connection.getOutputStream();
        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("NOTIFY\n");
        textOut.append(format("barrier:%s\n", notify.getBarrier()));
        textOut.append("\n");
        textOut.flush();
    }

    private void writeCommand(AwaitCommand await) throws IOException, CharacterCodingException {
        OutputStream bytesOut = connection.getOutputStream();
        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("AWAIT\n");
        textOut.append(format("barrier:%s\n", await.getBarrier()));
        textOut.append("\n");
        textOut.flush();
    }

// Path: control/src/main/java/org/kaazing/k3po/control/internal/command/CloseCommand.java
// public final class CloseCommand extends Command {
// 
//     @Override
//     public Kind getKind() {
//         return Kind.CLOSE;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(getKind());
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         return o == this || o instanceof CloseCommand && equalTo((CloseCommand) o);
//     }
// 
// }
// 
// Path: control/src/main/java/org/kaazing/k3po/control/internal/command/Command.java
// public abstract class Command {
// 
//     /**
//      * Kind of Command.
//      *
//      */
//     public enum Kind {
//         /**
//          * Prepare command.
//          */
//         PREPARE,
//         /**
//          * Start command.
//          */
//         START,
//         /**
//          * Abort command.
//          */
//         ABORT,
//         /**
//          * Await command.
//          */
//         AWAIT,
//         /**
//          * Notify command.
//          */
//         NOTIFY,
//         /**
//          * Close command.
//          */
//         CLOSE
//     }
// 
//     /**
//      * @return Kind
//      */
//     public abstract Kind getKind();
// 
//     @Override
//     public abstract int hashCode();
// 
//     @Override
//     public boolean equals(Object o) {
//         return o == this || o instanceof Command && equalTo((Command) o);
//     }
// 
//     protected final boolean equalTo(Command that) {
//         return Objects.equals(this.getKind(), that.getKind());
//     }
// 
// }


// Path: control/src/main/java/org/kaazing/k3po/control/internal/Control.java
import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.kaazing.k3po.control.internal.command.AbortCommand;
import org.kaazing.k3po.control.internal.command.AwaitCommand;
import org.kaazing.k3po.control.internal.command.CloseCommand;
import org.kaazing.k3po.control.internal.command.Command;
import org.kaazing.k3po.control.internal.command.NotifyCommand;
import org.kaazing.k3po.control.internal.command.PrepareCommand;
import org.kaazing.k3po.control.internal.command.StartCommand;
import org.kaazing.k3po.control.internal.event.CommandEvent;
import org.kaazing.k3po.control.internal.event.ErrorEvent;
import org.kaazing.k3po.control.internal.event.FinishedEvent;
import org.kaazing.k3po.control.internal.event.NotifiedEvent;
import org.kaazing.k3po.control.internal.event.PreparedEvent;
import org.kaazing.k3po.control.internal.event.StartedEvent;

        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("ABORT\n");
        textOut.append("\n");
        textOut.flush();
    }

    private void writeCommand(NotifyCommand notify) throws IOException, CharacterCodingException {
        OutputStream bytesOut = connection.getOutputStream();
        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("NOTIFY\n");
        textOut.append(format("barrier:%s\n", notify.getBarrier()));
        textOut.append("\n");
        textOut.flush();
    }

    private void writeCommand(AwaitCommand await) throws IOException, CharacterCodingException {
        OutputStream bytesOut = connection.getOutputStream();
        CharsetEncoder encoder = UTF_8.newEncoder();
        Writer textOut = new OutputStreamWriter(bytesOut, encoder);

        textOut.append("AWAIT\n");
        textOut.append(format("barrier:%s\n", await.getBarrier()));
        textOut.append("\n");
        textOut.flush();
    }

    private void writeCommand(CloseCommand close) throws IOException, CharacterCodingException {