Interface MockApnsServerListener

All Known Implementing Classes:
ParsingMockApnsServerListenerAdapter

public interface MockApnsServerListener

Mock APNs server listeners are notified when push notifications are accepted or rejected by a MockApnsServer. Listeners have no effect on a server's handling of push notifications, and are designed for use in integration testing.

Note that the mock server's decision to accept or reject a push notification is controlled by its PushNotificationHandler. As a result, notifications accepted by a mock server might be rejected by a real APNs server or vice versa. Notifications passed to listeners may have missing, incomplete, or nonsense data regardless of whether they were accepted or rejected, and callers should use appropriate caution. Parsing notification headers/payloads into ApnsPushNotification instances is the responsibility of the caller, and callers may with to subclass ParsingMockApnsServerListenerAdapter if they need to work with ApnsPushNotification instances instead of raw headers and byte buffers.

Since:
0.12
See Also:
  • Method Details

    • handlePushNotificationAccepted

      void handlePushNotificationAccepted(Http2Headers headers, ByteBuf payload)
      Indicates that a push notification has been accepted by the mock server.
      Parameters:
      headers - the notification's HTTP/2 headers
      payload - the notification's payload
    • handlePushNotificationRejected

      void handlePushNotificationRejected(Http2Headers headers, ByteBuf payload, RejectionReason rejectionReason, Instant deviceTokenExpirationTimestamp)
      Indicates that a push notification has been rejected by the mock server.
      Parameters:
      headers - the notification's HTTP/2 headers
      payload - the notification's payload
      rejectionReason - the reason the push notification was rejected by the mock server
      deviceTokenExpirationTimestamp - the time at which the push notification's destination device token expired; may be null if the token has not expired