From 5229954adf0d51afd2d376ed4581ae6d1bd059fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Tue, 24 Apr 2012 17:39:50 +0200 Subject: Add timout support in Rpc. Use with Rpc.setTimeout(). --- .../com/orbekk/protobuf/ProtobufFunctionalTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/test/java') 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() { + @Override public void run(Type2 result) { + stop.countDown(); + } + }); + rpc.await(); + assertThat(rpc.failed(), is(true)); + assertThat(rpc.errorText(), is("timeout")); + returnC.countDown(); + stop.await(); + } } -- cgit v1.2.3