Skip to content

Commit c520831

Browse files
committed
timeout tests
Change-Id: Ie6dfa8bf891d2c7e44c966e59f972bc1c5babb50
1 parent 647ec73 commit c520831

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
}

0 commit comments

Comments
 (0)