VpnWatchdog { void initialize(boolean enabled) throws InterruptedException { Log.d(TAG, "initialize: Initializing watchdog"); pollTimeout = POLL_TIMEOUT_START; lastPacketSent = 0; this.enabled = enabled; if (!enabled) { Log.d(TAG, "initialize: Disabled."); return; } if (initPenalty > 0) { Log.d(TAG, "init penalty: Sleeping for " + initPenalty + "ms"); Thread.sleep(initPenalty); } }    }
@Test public void testInitialize() throws Exception { watchdog.initialize(true); assertEquals(1000, watchdog.getPollTimeout()); assertEquals(0, watchdog.lastPacketSent); watchdog.initPenalty = 100; watchdog.initialize(true); }