mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Check periodically for retransmittable packets. Bug #46.
This commit is contained in:
@@ -26,9 +26,9 @@ import org.junit.Test;
|
||||
public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
private static final long EPOCH = 1000L * 1000L * 1000L * 1000L;
|
||||
private static final long MAX_LATENCY = 2 * 60 * 1000; // 2 minutes
|
||||
private static final long ROTATION_PERIOD_LENGTH =
|
||||
MAX_LATENCY + MAX_CLOCK_DIFFERENCE;
|
||||
private static final int MAX_LATENCY = 2 * 60 * 1000; // 2 minutes
|
||||
private static final int ROTATION_PERIOD =
|
||||
MAX_CLOCK_DIFFERENCE + MAX_LATENCY;
|
||||
|
||||
private final ContactId contactId;
|
||||
private final TransportId transportId;
|
||||
@@ -294,7 +294,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
MAX_LATENCY)));
|
||||
// The current time is the start of period 2
|
||||
oneOf(clock).currentTimeMillis();
|
||||
will(returnValue(EPOCH + ROTATION_PERIOD_LENGTH));
|
||||
will(returnValue(EPOCH + ROTATION_PERIOD));
|
||||
// The secret for period 3 should be derived and stored
|
||||
oneOf(crypto).deriveNextSecret(secret0, 1);
|
||||
will(returnValue(secret1.clone()));
|
||||
@@ -353,7 +353,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
MAX_LATENCY)));
|
||||
// The current time is the end of period 3
|
||||
oneOf(clock).currentTimeMillis();
|
||||
will(returnValue(EPOCH + 3 * ROTATION_PERIOD_LENGTH - 1));
|
||||
will(returnValue(EPOCH + 3 * ROTATION_PERIOD - 1));
|
||||
// The secrets for periods 3 and 4 should be derived from secret 1
|
||||
oneOf(crypto).deriveNextSecret(secret1, 2);
|
||||
will(returnValue(secret2.clone()));
|
||||
@@ -484,7 +484,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// run() during period 2: the secrets should be rotated
|
||||
oneOf(clock).currentTimeMillis();
|
||||
will(returnValue(EPOCH + ROTATION_PERIOD_LENGTH + 1));
|
||||
will(returnValue(EPOCH + ROTATION_PERIOD + 1));
|
||||
oneOf(crypto).deriveNextSecret(secret0, 1);
|
||||
will(returnValue(secret1.clone()));
|
||||
oneOf(crypto).deriveNextSecret(secret1, 2);
|
||||
@@ -559,7 +559,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// run() during period 3 (late): the secrets should be rotated
|
||||
oneOf(clock).currentTimeMillis();
|
||||
will(returnValue(EPOCH + 2 * ROTATION_PERIOD_LENGTH + 1));
|
||||
will(returnValue(EPOCH + 2 * ROTATION_PERIOD + 1));
|
||||
oneOf(crypto).deriveNextSecret(secret1, 2);
|
||||
will(returnValue(secret2.clone()));
|
||||
oneOf(crypto).deriveNextSecret(secret2, 3);
|
||||
|
||||
Reference in New Issue
Block a user