-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeepAliveTest.java
More file actions
34 lines (26 loc) · 902 Bytes
/
KeepAliveTest.java
File metadata and controls
34 lines (26 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package servertests;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import edu.nju.http.server.HttpServer;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import static util.Util.*;
public class KeepAliveTest {
static HttpServer server;
static CompletableFuture<Void> future;
@BeforeAll
static void startUp() throws IOException {
server = new HttpServer();
future = CompletableFuture.runAsync(() -> server.launch(true, 100000));
}
@Test
void test1() throws IOException, InterruptedException {
testAndCompareWebPage("127.0.0.1", 8080, "/OS/2022/", "/OS/2022/labs/M3/");
}
@AfterAll
static void cleanUp() throws ExecutionException, InterruptedException {
server.shutdown();
}
}