Better checking of max apns payload size
Fixes #329