Read response packets from the current APNS connection and process them.

@param notificationManager
@return the number of response packets received and processed
979821
public static int processResponses(PushNotificationManager notificationManager) {
		List<ResponsePacket> responses = readResponses(notificationManager.getActiveSocket());
		handleResponses(responses, notificationManager);
		return responses.size();
	}
151085
private void processFCM(AndroidVariant androidVariant, List<String> pushTargets, Message fcmMessage, ConfigurableFCMSender sender) throws IOException {


        // push targets can be registration IDs OR topics (starting /topic/), but they can't be mixed.
        if (pushTargets.get(0).startsWith(Constants.TOPIC_PREFIX)) {

            // perform the topic delivery

            for (String topic : pushTargets) {
                logger.info(String.format("Sent push notification to FCM topic: %s", topic));
                Result result = sender.sendNoRetry(fcmMessage, topic);

                logger.trace("Response from FCM topic request: {}", result);
            }
        } else {
            logger.info(String.format("Sent push notification to FCM Server for %d registrationIDs", pushTargets.size()));
            MulticastResult multicastResult = sender.sendNoRetry(fcmMessage, pushTargets);

            logger.trace("Response from FCM request: {}", multicastResult);

            // after sending, let's identify the inactive/invalid registrationIDs and trigger their deletion:
            cleanupInvalidRegistrationIDsForVariant(androidVariant.getVariantID(), multicastResult, pushTargets);
        }
    }
1314382
public boolean checkSignature(PaymentNotification notification) {
        SortedMap<String, Object> notificationMap = JsonMapper.nonEmptyMapper().getMapper().convertValue(notification, SortedMap.class);
        notificationMap.putAll(notification.getOthers());
        notificationMap.remove("sign");
        return notification.getSign().equals(SignatureUtil.sign(notificationMap, paySetting.getKey()));
    }
856755
def write(self, notifications):
    ""
    if not self.factory:
      log.msg('APNSService write (connecting)')
      server, port = ((APNS_SERVER_SANDBOX_HOSTNAME 
                      if self.environment == 'sandbox'
                      else APNS_SERVER_HOSTNAME), APNS_SERVER_PORT)
      self.factory = self.clientProtocolFactory()
      context = self.getContextFactory()
      reactor.connectSSL(server, port, self.factory, context)
    
    client = self.factory.clientProtocol
    if client:
      return client.sendMessage(notifications)
    else:      
      d = self.factory.deferred
      timeout = reactor.callLater(self.timeout, 
        lambda: d.called or d.errback(
          Exception('Notification timed out after %i seconds' % self.timeout)))
      def cancel_timeout(r):
        try: timeout.cancel()
        except: pass
        return r
      
      d.addCallback(lambda p: p.sendMessage(notifications))
      d.addErrback(log_errback('apns-service-write'))
      d.addBoth(cancel_timeout)
      return d
594982
def check_notification(self, code):
        
        response = self.get(url=self.config.NOTIFICATION_URL % code)
        return PagSeguroNotificationResponse(response.content, self.config)
968017
public void addClientNotificationListener(RESTRequest request, NotificationRegistration notificationRegistration, JSONConverter converter) {
        String objectNameStr = notificationRegistration.objectName.getCanonicalName();

        NotificationTargetInformation nti = toNotificationTargetInformation(request, objectNameStr);

        // Get the listener
        ClientNotificationListener listener = listeners.get(nti);
        if (listener == null) {
            listener = new ClientNotificationListener(this);
            ClientNotificationListener mapListener = listeners.putIfAbsent(nti, listener);

            if (mapListener != null) {
                listener = mapListener;
            }
        }

        // Grab the wrapper filter which will be registered in the MBeanServer
        NotificationFilter filter = listener.getClientWrapperFilter();

        // Check whether the producer of the notification is local or remote.
        if (nti.getRoutingInformation() == null) {
            // Add the notification in the MBeanServer        
            MBeanServerHelper.addClientNotification(notificationRegistration.objectName,
                                                    listener,
                                                    filter,
                                                    null,
                                                    converter);
        } else {
            // Add the notification listener to the Target-Client Manager through EventAdmin
            MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
            helper.addRoutedNotificationListener(nti, listener, converter);
        }

        // Add the filters to the listener
        listener.addClientNotification(notificationRegistration.filters);
    }
1217428
@SuppressWarnings({"unused", "WeakerAccess"})
    public static NotificationInfo getNotificationInfo(final Bundle extras) {
        if (extras == null) return new NotificationInfo(false, false);

        boolean fromCleverTap = extras.containsKey(Constants.NOTIFICATION_TAG);
        boolean shouldRender = fromCleverTap && extras.containsKey("nm");
        return new NotificationInfo(fromCleverTap, shouldRender);
    }
1226105
public static Response getStatusResponse(Response.Status status, String... messages) {
		if (status == null) {
			return Response.status(Response.Status.BAD_REQUEST).build();
		}
		String msg = StringUtils.join(messages, ". ");
		if (StringUtils.isBlank(msg)) {
			msg = status.getReasonPhrase();
		}
		try {
			return GenericExceptionMapper.getExceptionResponse(status.getStatusCode(), msg);
		} catch (Exception ex) {
			logger.error(null, ex);
			return Response.status(Response.Status.BAD_REQUEST).build();
		}
	}
1228099
@Override
    protected void enqueueNotification(final Notification not) {
        not.lastRun = System.currentTimeMillis();
        final SubscriptionSummary summary = postNotification(not.subscriber, not.mimeType, not.payload);
        not.callback.onSummaryInfo(summary);
    }
1191892
public NotificationRecord[] fetchNotifications() {
        if (notifications.isEmpty()) {
            //Need to have a timedOut flag because of possible spurious wakeup
            final long timedOut = System.nanoTime() + deliveryInterval;

            synchronized (waitFlag) {
                while (notifications.isEmpty() && (System.nanoTime() < timedOut)) {
                    try {
                        waitFlag.wait(deliveryInterval / 1000000L);
                    } catch (InterruptedException e) {
                        //keep waiting until conditions aren't met anymore
                    }
                }
            }
        }

        NotificationRecord[] fetchedNotifications = null;

        if (!notifications.isEmpty()) {
            synchronized (notifications) {
                fetchedNotifications = notifications.toArray(new NotificationRecord[notifications.size()]);
                notifications.clear();
            }
        }

        //Update the timestamp
        lastAccessTimeStamp = System.nanoTime();

        return fetchedNotifications;
    }
379746
public java.util.Map<String, IdentityNotificationAttributes> getNotificationAttributes() {
        if (notificationAttributes == null) {
            notificationAttributes = new com.amazonaws.internal.SdkInternalMap<String, IdentityNotificationAttributes>();
        }
        return notificationAttributes;
    }
327330
def process_notifications(self, messages):
        """"""
        for object_id, object_size, metadata_size in messages:
            if object_size > 0 and object_id in self._waiting_dict:
                linked_list = self._waiting_dict[object_id]
                self._complete_future(linked_list)
831099
public static NotificationManager getInstance(Context context) {
        if (sInstance == null) {
            sInstance = new NotificationManager(context);
        }
        return sInstance;
    }
848520
public long getNumberOfMessagesReceived()
   {
     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
       SibTr.entry(tc, "getNumberOfMessagesReceived");
     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
       SibTr.exit(tc, "getNumberOfMessagesReceived", new Long(messagesReceived));
     
     return messagesReceived;
   }
1208346
public java.util.List<NotificationConfiguration> getNotificationConfigurations() {
        if (notificationConfigurations == null) {
            notificationConfigurations = new com.amazonaws.internal.SdkInternalList<NotificationConfiguration>();
        }
        return notificationConfigurations;
    }
452648
@Override
    public void handleNotification(Notification notification, Object handback) {
        String notificationType = notification.getType();
        if (notificationType.equals(JMXConnectionNotification.OPENED)) {
            managementContext.incrementManagementSessionCount();
        } else if (notificationType.equals(JMXConnectionNotification.CLOSED)) {
            managementContext.decrementManagementSessionCount();
        }
    }
504564
def read(self):
    ""
    log.msg('APNSService read (connecting)')
    try:
      server, port = ((FEEDBACK_SERVER_SANDBOX_HOSTNAME 
                      if self.environment == 'sandbox'
                      else FEEDBACK_SERVER_HOSTNAME), FEEDBACK_SERVER_PORT)
      factory = self.feedbackProtocolFactory()
      context = self.getContextFactory()
      reactor.connectSSL(server, port, factory, context)
      factory.deferred.addErrback(log_errback('apns-feedback-read'))
      
      timeout = reactor.callLater(self.timeout,
        lambda: factory.deferred.called or factory.deferred.errback(
          Exception('Feedbcak fetch timed out after %i seconds' % self.timeout)))
      def cancel_timeout(r):
        try: timeout.cancel()
        except: pass
        return r
      
      factory.deferred.addBoth(cancel_timeout)
    except Exception, e:
      log.err('APNService feedback error initializing: %s' % str(e))
      raise
    return factory.deferred