Interface PushNotificationHandler


  • public interface PushNotificationHandler

    Push notification handlers process push notifications sent to a MockApnsServer and decide how the server should respond to those notifications. Implementers can write handlers to simulate a variety of server behaviors and error conditions without setting up elaborate pre-conditions.

    Push notification handler instances are bound to a specific connection and will always be called by the same thread; as a result, implementations are inherently thread-safe.

    Since:
    0.12
    See Also:
    PushNotificationHandlerFactory
    • Method Summary

      Modifier and Type Method Description
      void handlePushNotification​(Http2Headers headers, ByteBuf payload)
      Processes a push notification received by a mock server.
    • Method Detail

      • handlePushNotification

        void handlePushNotification​(Http2Headers headers,
                                    ByteBuf payload)
                             throws RejectedNotificationException
        Processes a push notification received by a mock server. Implementations should exit normally to indicate that a notification should be accepted by the server. If an implementation throws a RejectedNotificationException, the server will reject the notification. If implementations throw a RuntimeException, the server will report an internal server error to clients.
        Parameters:
        headers - the notification's HTTP/2 headers
        payload - the notification's payload; may be empty or null
        Throws:
        RejectedNotificationException - if the server should reject the push notification for a specific reason