@Override
  public Response processAddConnection(ConnectionInfo info) throws Exception {
    WireFormatInfo wireFormatInfo = wireFormat.getPreferedWireFormatInfo();
    // Older clients should have been defaulting this field to true.. but
    // they were not.
    if (wireFormatInfo != null && wireFormatInfo.getVersion() <= 2) {
      info.setClientMaster(true);
    }

    state = new ConnectionState(info);

    context = new AMQConnectionContext();

    state.reset(info);

    this.faultTolerantConnection = info.isFaultTolerant();
    // Setup the context.
    String clientId = info.getClientId();
    context.setBroker(protocolManager);
    context.setClientId(clientId);
    context.setClientMaster(info.isClientMaster());
    context.setConnection(this);
    context.setConnectionId(info.getConnectionId());
    // for now we pass the manager as the connector and see what happens
    // it should be related to activemq's Acceptor
    context.setConnector(this.acceptorUsed);
    context.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy());
    context.setNetworkConnection(networkConnection);
    context.setFaultTolerant(faultTolerantConnection);
    context.setTransactions(new ConcurrentHashMap<TransactionId, AMQTransaction>());
    context.setUserName(info.getUserName());
    context.setWireFormatInfo(wireFormatInfo);
    context.setReconnect(info.isFailoverReconnect());
    this.manageable = info.isManageable();
    context.setConnectionState(state);
    if (info.getClientIp() == null) {
      info.setClientIp(getRemoteAddress());
    }

    try {
      protocolManager.addConnection(context, info);
    } catch (Exception e) {
      if (e instanceof SecurityException) {
        // close this down - in case the peer of this transport doesn't play
        // nice
        delayedStop(2000, "Failed with SecurityException: " + e.getLocalizedMessage(), e);
      }
      Response resp = new ExceptionResponse(e);
      return resp;
    }
    if (info.isManageable()) {
      // send ConnectionCommand
      ConnectionControl command = this.acceptorUsed.getConnectionControl();
      command.setFaultTolerant(protocolManager.isFaultTolerantConfiguration());
      if (info.isFailoverReconnect()) {
        command.setRebalanceConnection(false);
      }
      dispatchAsync(command);
    }
    return null;
  }
 // throw a WireFormatInfo to the peer
 public void init() {
   WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
   protocolManager.send(this, info);
 }