/*
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.kuujo.vertigo.output.impl;

import net.kuujo.vertigo.context.ConnectionContext;
import net.kuujo.vertigo.message.JsonMessage;
import net.kuujo.vertigo.message.MessageId;
import net.kuujo.vertigo.output.OutputConnection;
import net.kuujo.vertigo.util.serializer.Serializer;
import net.kuujo.vertigo.util.serializer.SerializerFactory;

import org.vertx.java.core.Vertx;
import org.vertx.java.core.eventbus.EventBus;

/**
 * Default output connection implementation.
 *
 * @author Jordan Halterman
 */
public class DefaultOutputConnection implements OutputConnection {
  private static final Serializer serializer = SerializerFactory.getSerializer(JsonMessage.class);
  private final String address;
  private final EventBus eventBus;

  public DefaultOutputConnection(Vertx vertx, ConnectionContext context) {
    this.eventBus = vertx.eventBus();
    this.address = context.address();
  }

  @Override
  public String address() {
    return address;
  }

  @Override
  public MessageId write(JsonMessage message) {
    eventBus.send(address, serializer.serializeToString(message));
    return message.messageId();
  }

}

@@ -1349,16 +1349,151 @@
 ntBus;%0A%0A
+  public DefaultOutputConnection(String address, Vertx vertx) %7B%0A    this.address = address;%0A    this.eventBus = vertx.eventBus();%0A  %7D%0A%0A
   public

Add output connection constructor for tests.