// Only add streams to the stream list once the stream has been
// opened. This helps ensure that we don't attempt to send messages
// on a closed stream.
for (OutputStreamContext output : context.streams()) {
final OutputStream stream = new DefaultOutputStream(vertx, output);
stream.setSendQueueMaxSize(maxQueueSize);
stream.drainHandler(drainHandler);
stream.open(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(String.format("%s - Failed to open output stream: %s", DefaultOutputPort.this, stream));
counter.fail(result.cause());