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/TestClient.java b/test/java/src/TestClient.java
index 85aac9e..4e0482a 100644
--- a/test/java/src/TestClient.java
+++ b/test/java/src/TestClient.java
@@ -357,6 +357,22 @@
         }
         System.out.print("}\n");
 
+        // Test async
+        System.out.print("testAsync(3)...");
+        long startAsync = System.nanoTime();
+        testClient.testAsync(3);
+        long asyncElapsedMillis = (System.nanoTime() - startAsync) / 1000000;
+        if (asyncElapsedMillis > 200) {
+          throw new Exception("Async test failed: took " +
+                              Long.toString(asyncElapsedMillis) +
+                              "ms");
+        } else {
+          System.out.println("Success - took " +
+                             Long.toString(asyncElapsedMillis) +
+                             "ms");
+        }
+
+
         long stop = System.nanoTime();
         long tot = stop-start;
 
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) {