Class ParsingMockApnsServerListenerAdapter

java.lang.Object
com.eatthepath.pushy.apns.server.ParsingMockApnsServerListenerAdapter
All Implemented Interfaces:
MockApnsServerListener

public abstract class ParsingMockApnsServerListenerAdapter extends Object implements MockApnsServerListener

A parsing APNs server listener is an abstract base class that parses HTTP/2 headers and payload byte buffers from a mock APNs server into ApnsPushNotification instances for easier handling.

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. Push notifications parsed by this class may have missing, incomplete, or nonsense data regardless of whether they were accepted or rejected, and callers should use appropriate caution.

Since:
0.12
See Also:
  • Constructor Details

    • ParsingMockApnsServerListenerAdapter

      public ParsingMockApnsServerListenerAdapter()
  • Method Details

    • handlePushNotificationAccepted

      public void handlePushNotificationAccepted(Http2Headers headers, ByteBuf payload)
      Parses a push notification accepted by a mock APNs server into an ApnsPushNotification instance for further processing by handlePushNotificationAccepted(ApnsPushNotification).
      Specified by:
      handlePushNotificationAccepted in interface MockApnsServerListener
      Parameters:
      headers - the notification's HTTP/2 headers
      payload - the notification's payload
    • handlePushNotificationAccepted

      public abstract void handlePushNotificationAccepted(ApnsPushNotification pushNotification)
      Handles a parsed push notification accepted by a mock server. Note that any field of the parsed push notification may be null.
      Parameters:
      pushNotification - the notification accepted by the server
    • handlePushNotificationRejected

      public void handlePushNotificationRejected(Http2Headers headers, ByteBuf payload, RejectionReason rejectionReason, Instant deviceTokenExpirationTimestamp)
      Parses a push notification rejected by a mock APNs server into an ApnsPushNotification instance for further processing by handlePushNotificationRejected(ApnsPushNotification, RejectionReason, Instant).
      Specified by:
      handlePushNotificationRejected in interface MockApnsServerListener
      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;
    • handlePushNotificationRejected

      public abstract void handlePushNotificationRejected(ApnsPushNotification pushNotification, RejectionReason rejectionReason, Instant deviceTokenExpirationTimestamp)
      Handles a parsed push notification accepted by a mock server. Note that any field of the parsed push notification may be null.
      Parameters:
      pushNotification - the push notification rejected by the server
      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;