def add_handler(app_id, opts={}, &blk)
      vendor = opts.fetch(:vendor, 0)
      auth = opts.fetch(:auth, false)
      acct = opts.fetch(:acct, false)

      raise ArgumentError.new("Must specify at least one of auth or acct") unless auth or acct
      
      @acct_apps << [app_id, vendor] if acct
      @auth_apps << [app_id, vendor] if auth
      
      @handlers[app_id] = blk
    end
def add_handler(app_id, opts={}, &blk)
      vendor = opts.fetch(:vendor, 0)
      auth = opts.fetch(:auth, false)
      acct = opts.fetch(:acct, false)

      raise ArgumentError.new("Must specify at least one of auth or acct") unless auth or acct
      
      @acct_apps << [app_id, vendor] if acct
      @auth_apps << [app_id, vendor] if auth
      
      @handlers[app_id] = blk
    end
Adds a handler for a specific Diameter application.

 @note If you expect to only send requests for this application,
  not receive them, the block can be a no-op (e.g. `{ nil }`)

 @param app_id [Fixnum] The Diameter application ID.
 @option opts [true, false] auth
   Whether we should advertise support for this application in
   the Auth-Application-ID AVP. Note that at least one of auth or
   acct must be specified.
 @option opts [true, false] acct
   Whether we should advertise support for this application in
   the Acct-Application-ID AVP. Note that at least one of auth or
   acct must be specified.
 @option opts [Fixnum] vendor
  If we should advertise support for this application in a
  Vendor-Specific-Application-Id AVP, this specifies the
  associated Vendor-Id.

 @yield [req, cxn] Passes a Diameter message (and its originating
  connection) for application-specific handling.
 @yieldparam [Message] req The parsed Diameter message from the peer.
 @yieldparam [Socket] cxn The TCP connection to the peer, to be
  passed to {Stack#send_answer}.