private void scheduleMaxDelayTask(final int count) {
        if (count > 0) {
            // Nothing to validate
            return;
        }
        try {
            BOSHClient session = client.get();
            if (session == null) {
                // Client not set
                return;
            }
            CMSessionParams params = session.getCMSessionParams();
            if (params == null) {
                // Nothing to validate against
                return;
            }
            AttrInactivity inactivity = params.getInactivityPeriod();
            int max;
            if (inactivity == null) {
                max = 1;
            } else {
                max = inactivity.intValue();
            }
            LOG.finest("Scheduling inactivity timer");
            inactivityRef.set(schedExec.schedule(
                    new InactivityChecker(max), max, TimeUnit.SECONDS));
        } catch (Error err) {
            toThrow.compareAndSet(null, err);
        }
    }