Add testAsync to ThriftTest.thrift which verifies async void works properly.
Summary:
- testAsync takes a number of seconds to sleep. The test client makes sure
that the RPC returns in less than 0.2 seconds even though it asks the server
to sleep for 3 seconds.
- Implemented this test for C++ and Java.
Test Plan:
- ran cpp TestServer and TestClient and verified functionality
- tested cpp and java test server/client against each other - tests passed
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665484 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/java/src/TestServer.java b/test/java/src/TestServer.java
index 21003b1..92fd4d2 100644
--- a/test/java/src/TestServer.java
+++ b/test/java/src/TestServer.java
@@ -234,6 +234,17 @@
return result;
}
+ public void testAsync(int sleepFor) {
+ System.out.println("testAsync(" + Integer.toString(sleepFor) +
+ ") => sleeping...");
+ try {
+ Thread.sleep(sleepFor * 1000);
+ System.out.println("Done sleeping!");
+ } catch (InterruptedException ie) {
+ throw new RuntimeException(ie);
+ }
+ }
+
} // class TestHandler
public static void main(String [] args) {