} catch (RuntimeException e) {
logger.log(Level.SEVERE, "Error sending messages to APN server", e);
callback.onError("Error sending messages to APN server");
} finally {
// tear down and release resources:
service.stop();
}
} else {
logger.log(Level.SEVERE, "No certificate was found. Could not send messages to APNs");
callback.onError("No certificate for APNs was found");
}