File tree 1 file changed +52
-0
lines changed
AndroidAsyncTest/src/com/koushikdutta/async/test 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .koushikdutta .async .test ;
2
+
3
+ import com .koushikdutta .async .AsyncServer ;
4
+ import com .koushikdutta .async .http .server .AsyncHttpServer ;
5
+ import com .koushikdutta .async .http .server .AsyncHttpServerRequest ;
6
+ import com .koushikdutta .async .http .server .AsyncHttpServerResponse ;
7
+ import com .koushikdutta .async .http .server .HttpServerRequestCallback ;
8
+
9
+ import junit .framework .TestCase ;
10
+
11
+ /**
12
+ * Created by koush on 7/11/13.
13
+ */
14
+ public class TimeoutTests extends TestCase {
15
+ public TimeoutTests () {
16
+ server .get ("/3" , new HttpServerRequestCallback () {
17
+ @ Override
18
+ public void onRequest (AsyncHttpServerRequest request , final AsyncHttpServerResponse response ) {
19
+ // never respond
20
+ AsyncServer .getDefault ().postDelayed (new Runnable () {
21
+ @ Override
22
+ public void run () {
23
+ response .send ("3" );
24
+ }
25
+ }, 3000 );
26
+ }
27
+ });
28
+
29
+ server .get ("/now" , new HttpServerRequestCallback () {
30
+ @ Override
31
+ public void onRequest (AsyncHttpServerRequest request , AsyncHttpServerResponse response ) {
32
+ response .send ("now" );
33
+ }
34
+ });
35
+ }
36
+ AsyncHttpServer server = new AsyncHttpServer ();
37
+
38
+ @ Override
39
+ protected void setUp () throws Exception {
40
+ super .setUp ();
41
+ server .listen (AsyncServer .getDefault (), 5000 );
42
+ }
43
+
44
+ @ Override
45
+ protected void tearDown () throws Exception {
46
+ super .tearDown ();
47
+ AsyncServer .getDefault ().stop ();
48
+ }
49
+
50
+ public void testTimeout () throws Exception {
51
+ }
52
+ }
You can’t perform that action at this time.
0 commit comments