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.
MockApnsServerBuilder.setListener(MockApnsServerListener)
,
ParsingMockApnsServerListenerAdapter
Modifier and Type | Method and Description |
---|---|
void |
handlePushNotificationAccepted(Http2Headers headers,
ByteBuf payload)
Indicates that a push notification has been accepted by the mock server.
|
void |
handlePushNotificationRejected(Http2Headers headers,
ByteBuf payload,
RejectionReason rejectionReason,
Date deviceTokenExpirationTimestamp)
Indicates that a push notification has been rejected by the mock server.
|
void handlePushNotificationAccepted(Http2Headers headers, ByteBuf payload)
headers
- the notification's HTTP/2 headerspayload
- the notification's payloadvoid handlePushNotificationRejected(Http2Headers headers, ByteBuf payload, RejectionReason rejectionReason, Date deviceTokenExpirationTimestamp)
headers
- the notification's HTTP/2 headerspayload
- the notification's payloadrejectionReason
- the reason the push notification was rejected by the mock serverdeviceTokenExpirationTimestamp
- the time at which the push notification's destination device token expired;
may be null
if the token has not expiredCopyright © 2013–2018 Turo. All rights reserved.