### Question:
Heartbeat { public boolean sessionTimeoutExpired(long now) { return now - Math.max(lastSessionReset, lastHeartbeatReceive) > sessionTimeout; } Heartbeat(long sessionTimeout,
                     long heartbeatInterval,
                     long maxPollInterval,
                     long retryBackoffMs); void poll(long now); void sentHeartbeat(long now); void failHeartbeat(); void receiveHeartbeat(long now); boolean shouldHeartbeat(long now); long lastHeartbeatSend(); long timeToNextHeartbeat(long now); boolean sessionTimeoutExpired(long now); long interval(); void resetTimeouts(long now); boolean pollTimeoutExpired(long now);  }### Answer:
@Test public void testSessionTimeoutExpired() { heartbeat.sentHeartbeat(time.milliseconds()); time.sleep(305); assertTrue(heartbeat.sessionTimeoutExpired(time.milliseconds())); }