java: Allow CanceledException in the testTimeout
According to ashankar@, when a host has more than one address a
CanceledException is actually a valid outcome when using a timeout.
Change-Id: Icaf03cb922bc04646a4618d95346143e974f391e
diff --git a/lib/src/test/java/io/v/v23/VFuturesTest.java b/lib/src/test/java/io/v/v23/VFuturesTest.java
index a1e4b22..d245c77 100644
--- a/lib/src/test/java/io/v/v23/VFuturesTest.java
+++ b/lib/src/test/java/io/v/v23/VFuturesTest.java
@@ -4,10 +4,10 @@
package io.v.v23;
+import io.v.v23.verror.CanceledException;
import org.joda.time.Duration;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
@@ -55,8 +55,7 @@
* When the context times out while a Vanadium server is handling the request, we expect a
* {@link TimeoutException}.
*/
- @Ignore
- @Test(expected = TimeoutException.class)
+ @Test
public void testTimeout() throws Exception {
// Make the server hang forever; never count down
final CountDownLatch callLatch = new CountDownLatch(1);
@@ -68,6 +67,10 @@
final VContext timeout = ctx.withTimeout(Duration.millis(100));
- sync(client.get(timeout));
+ try {
+ sync(client.get(timeout));
+ } catch (TimeoutException | CanceledException e) {
+ // OK
+ }
}
}