static boolean isStale(OmemoDevice userDevice, OmemoDevice subject, Date lastReceipt, int maxAgeHours) {
        if (userDevice.equals(subject)) {
            return false;
        }

        if (lastReceipt == null) {
            return false;
        }

        long maxAgeMillis = MILLIS_PER_HOUR * maxAgeHours;
        Date now = new Date();

        return now.getTime() - lastReceipt.getTime() > maxAgeMillis;
    }
@Test
    public void isStaleDeviceTest() throws XmppStringprepException {
        OmemoDevice user = new OmemoDevice(JidCreate.bareFrom("alice@wonderland.lit"), 123);
        OmemoDevice other = new OmemoDevice(JidCreate.bareFrom("bob@builder.tv"), 444);

        Date now = new Date();
        Date deleteMe = new Date(now.getTime() - ((DELETE_STALE + 1) * ONE_HOUR));

        // Devices one hour "older" than max ages are stale
        assertTrue(OmemoService.isStale(user, other, deleteMe, DELETE_STALE));

        // Own device is never stale, no matter how old
        assertFalse(OmemoService.isStale(user, user, deleteMe, DELETE_STALE));

        // Always return false if date is null.
        assertFalse(OmemoService.isStale(user, other, null, DELETE_STALE));
    }