summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-24 17:39:50 +0200
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-24 17:39:50 +0200
commit5229954adf0d51afd2d376ed4581ae6d1bd059fa (patch)
tree35cb679e4aa11f43175a3f1a9556285d312e3f1f /src/test/java
parent6794f9be9a55fdf01179a344b68626d1126caa8a (diff)
Add timout support in Rpc.
Use with Rpc.setTimeout().
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java b/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java
index bf30f59..a1661d2 100644
--- a/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java
+++ b/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java
@@ -161,4 +161,22 @@ public class ProtobufFunctionalTest {
server.interrupt();
stop.await();
}
+
+ @org.junit.Test public void testTimout() throws Exception {
+ Test.Type1 request = Test.Type1.newBuilder().build();
+ final CountDownLatch stop = new CountDownLatch(1);
+
+ final Rpc rpc = new Rpc();
+ rpc.setTimout(1);
+ service.testC(rpc, request, new RpcCallback<Type2>() {
+ @Override public void run(Type2 result) {
+ stop.countDown();
+ }
+ });
+ rpc.await();
+ assertThat(rpc.failed(), is(true));
+ assertThat(rpc.errorText(), is("timeout"));
+ returnC.countDown();
+ stop.await();
+ }
}