@Override
public void exceptionCaught(final ChannelHandlerContext context, final Throwable cause) {
this.rejectFutureNotifications = true;
if (cause instanceof DecoderException) {
final DecoderException decoderException = (DecoderException)cause;
if (decoderException.getCause() instanceof ApnsDecoderException) {
if (this.server.shouldSendErrorResponses()) {
final ApnsDecoderException apnsDecoderException = (ApnsDecoderException)decoderException.getCause();
final RejectedNotification rejectedNotification =
new RejectedNotification(apnsDecoderException.sequenceNumber, apnsDecoderException.reason);
context.writeAndFlush(rejectedNotification).addListener(ChannelFutureListener.CLOSE);
}