@Override
    protected void onNotification(final ApnsServerSimulator.Notification notification, final InputOutputSocket inputOutputSocket)
            throws IOException {
        logger.debug("Queueing notification " + notification);
        queue.add(notification);
        final byte[] token = notification.getDeviceToken();
        if (token.length == 32 && token[0] == (byte)0xff && token[1] == (byte)0xff) {
            switch (token[2]) {
                case 0:
                    fail(token[3], notification.getIdentifier(), inputOutputSocket);
                    break;

                case 1:
                    try {
                        final int millis = token[3] * 100;
                        Thread.sleep(millis);
                    } catch (InterruptedException e) {
                        Thread.interrupted();
                    }
                    break;

                case 2:
                default:
                    inputOutputSocket.close();
                    break;
            }

        }
    }
A Server simulator that can simulate some failure modes.
src/test/java/com/notnoop/apns/utils/Simulator/FailingApnsServerSimulator.java