|
18 | 18 | import java.util.concurrent.TimeUnit; |
19 | 19 |
|
20 | 20 | public class WriteDataTest extends HttpRequestResponseFixture { |
21 | | - private final static String H2_HOST = "https://localhost:3443"; |
22 | | - private final static String H1_HOST = "https://localhost:8082"; |
| 21 | + private final static String HOST = "https://localhost"; |
| 22 | + private final static int H1_TLS_PORT = 8082; |
| 23 | + private final static int H2_TLS_PORT = 3443; |
23 | 24 |
|
24 | 25 | @Test |
25 | 26 | public void testHttp2WriteData() throws Exception { |
26 | 27 | skipIfAndroid(); |
27 | 28 | skipIfLocalhostUnavailable(); |
28 | 29 |
|
29 | | - URI uri = new URI(H2_HOST); |
| 30 | + URI uri = new URI(HOST + ":" + H2_TLS_PORT); |
30 | 31 | byte[] payload = "hello from writeData".getBytes(StandardCharsets.UTF_8); |
31 | 32 |
|
32 | 33 | HttpHeader[] headers = new HttpHeader[]{ |
33 | 34 | new HttpHeader(":method", "PUT"), |
34 | 35 | new HttpHeader(":path", "/echo"), |
35 | | - new HttpHeader(":scheme", uri.getScheme()), |
| 36 | + new HttpHeader(":scheme", "https"), |
36 | 37 | new HttpHeader(":authority", uri.getHost()), |
37 | 38 | new HttpHeader("content-length", Integer.toString(payload.length)), |
38 | 39 | }; |
@@ -94,12 +95,12 @@ public void testHttp2WriteDataEndStreamOnly() throws Exception { |
94 | 95 | skipIfAndroid(); |
95 | 96 | skipIfLocalhostUnavailable(); |
96 | 97 |
|
97 | | - URI uri = new URI(H2_HOST); |
| 98 | + URI uri = new URI(HOST + ":" + H2_TLS_PORT); |
98 | 99 |
|
99 | 100 | HttpHeader[] headers = new HttpHeader[]{ |
100 | 101 | new HttpHeader(":method", "GET"), |
101 | 102 | new HttpHeader(":path", "/echo"), |
102 | | - new HttpHeader(":scheme", uri.getScheme()), |
| 103 | + new HttpHeader(":scheme", "https"), |
103 | 104 | new HttpHeader(":authority", uri.getHost()), |
104 | 105 | }; |
105 | 106 | Http2Request request = new Http2Request(headers, null); |
@@ -159,7 +160,7 @@ public void testHttp1WriteData() throws Exception { |
159 | 160 | skipIfAndroid(); |
160 | 161 | skipIfLocalhostUnavailable(); |
161 | 162 |
|
162 | | - URI uri = new URI(H1_HOST); |
| 163 | + URI uri = new URI(HOST + ":" + H1_TLS_PORT); |
163 | 164 | byte[] payload = "hello from writeData h1".getBytes(StandardCharsets.UTF_8); |
164 | 165 |
|
165 | 166 | HttpHeader[] headers = new HttpHeader[]{ |
@@ -222,7 +223,7 @@ public void testHttp1WriteDataEndStreamOnly() throws Exception { |
222 | 223 | skipIfAndroid(); |
223 | 224 | skipIfLocalhostUnavailable(); |
224 | 225 |
|
225 | | - URI uri = new URI(H1_HOST); |
| 226 | + URI uri = new URI(HOST + ":" + H1_TLS_PORT); |
226 | 227 |
|
227 | 228 | HttpHeader[] headers = new HttpHeader[]{ |
228 | 229 | new HttpHeader("Host", uri.getHost()), |
|
0 commit comments