def send_notification(notification, delegate:, context: nil)
      raise ArgumentError, "Invalid notification: #{notification.inspect}" unless notification.valid?

      topic = notification.topic || @default_topic
      headers = {}
      headers["apns-expiration"] = (notification.expiration || 0).to_i
      headers["apns-id"]         = notification.formatted_id
      headers["apns-priority"]   = notification.priority     if notification.priority
      headers["apns-topic"]      = topic                     if topic

      body = notification.formatted_payload.to_json

      @connection.async.post(path: "/3/device/#{notification.token}",
                             headers: headers,
                             body: body,
                             delegate: delegate,
                             context: context)
    end
def send_notification(notification, delegate:, context: nil)
      raise ArgumentError, "Invalid notification: #{notification.inspect}" unless notification.valid?

      topic = notification.topic || @default_topic
      headers = {}
      headers["apns-expiration"] = (notification.expiration || 0).to_i
      headers["apns-id"]         = notification.formatted_id
      headers["apns-priority"]   = notification.priority     if notification.priority
      headers["apns-topic"]      = topic                     if topic

      body = notification.formatted_payload.to_json

      @connection.async.post(path: "/3/device/#{notification.token}",
                             headers: headers,
                             body: body,
                             delegate: delegate,
                             context: context)
    end
Verifies the `notification` is valid and then sends it to the remote service. Response feedback is provided via
 a delegate mechanism.

 @note   In general, you will probably want to use {#group} to be able to use {RequestGroup#send_notification},
         which takes a traditional blocks-based callback approach.

 @see    Connection#post

 @param  [Notification] notification
         the notification object whose data to send to the service.

 @param  [Connection::DelegateProtocol] delegate
         an object that implements the connection delegate protocol.

 @param  [Object, nil] context
         any object that you want to be passed to the delegate once the response is back.

 @raise  [ArgumentError]
         raised if the Notification is not {Notification#valid?}.

 @return [void]