|
52 | 52 | import java.io.InputStream;
|
53 | 53 | import java.net.HttpURLConnection;
|
54 | 54 | import java.net.ServerSocket;
|
55 |
| -import java.net.Socket; |
56 | 55 | import java.net.URL;
|
57 | 56 | import java.nio.charset.StandardCharsets;
|
58 | 57 | import java.time.Duration;
|
@@ -142,10 +141,6 @@ static void afterAll() {
|
142 | 141 |
|
143 | 142 | @BeforeEach
|
144 | 143 | void beforeEachTest() {
|
145 |
| - AbstractConfiguration config = ConfigurationManager.getConfigInstance(); |
146 |
| - config.setProperty("server.http.request.headers.read.timeout.enabled", false); |
147 |
| - config.setProperty("server.http.request.headers.read.timeout", 10000); |
148 |
| - |
149 | 144 | this.pathSegment = randomPathSegment();
|
150 | 145 | this.wmRuntimeInfo = wireMockExtension.getRuntimeInfo();
|
151 | 146 | this.wireMock = wireMockExtension.getRuntimeInfo().getWireMock();
|
@@ -271,63 +266,6 @@ void httpGetFailsDueToOriginReadTimeout(
|
271 | 266 | verifyResponseHeaders(response);
|
272 | 267 | }
|
273 | 268 |
|
274 |
| - @ParameterizedTest |
275 |
| - @MethodSource("arguments") |
276 |
| - void httpGetHappyPathWithHeadersReadTimeout( |
277 |
| - final String description, |
278 |
| - final OkHttpClient okHttp, |
279 |
| - final boolean requestBodyBuffering, |
280 |
| - final boolean responseBodyBuffering) |
281 |
| - throws Exception { |
282 |
| - AbstractConfiguration config = ConfigurationManager.getConfigInstance(); |
283 |
| - config.setProperty("server.http.request.headers.read.timeout.enabled", true); |
284 |
| - |
285 |
| - wireMock.register(get(anyUrl()).willReturn(ok().withBody("hello world"))); |
286 |
| - |
287 |
| - Request request = setupRequestBuilder(requestBodyBuffering, responseBodyBuffering) |
288 |
| - .get() |
289 |
| - .build(); |
290 |
| - Response response = okHttp.newCall(request).execute(); |
291 |
| - assertThat(response.code()).isEqualTo(200); |
292 |
| - assertThat(response.body().string()).isEqualTo("hello world"); |
293 |
| - verifyResponseHeaders(response); |
294 |
| - } |
295 |
| - |
296 |
| - @ParameterizedTest |
297 |
| - @MethodSource("arguments") |
298 |
| - void httpPostHappyPathWithHeadersReadTimeout( |
299 |
| - final String description, |
300 |
| - final OkHttpClient okHttp, |
301 |
| - final boolean requestBodyBuffering, |
302 |
| - final boolean responseBodyBuffering) |
303 |
| - throws Exception { |
304 |
| - AbstractConfiguration config = ConfigurationManager.getConfigInstance(); |
305 |
| - config.setProperty("server.http.request.headers.read.timeout.enabled", true); |
306 |
| - |
307 |
| - wireMock.register(post(anyUrl()).willReturn(ok().withBody("Thank you next"))); |
308 |
| - |
309 |
| - Request request = setupRequestBuilder(requestBodyBuffering, responseBodyBuffering) |
310 |
| - .post(RequestBody.create("Simple POST request body".getBytes(StandardCharsets.UTF_8))) |
311 |
| - .build(); |
312 |
| - Response response = okHttp.newCall(request).execute(); |
313 |
| - assertThat(response.code()).isEqualTo(200); |
314 |
| - assertThat(response.body().string()).isEqualTo("Thank you next"); |
315 |
| - verifyResponseHeaders(response); |
316 |
| - } |
317 |
| - |
318 |
| - @Test |
319 |
| - void httpGetFailsDueToHeadersReadTimeout() throws Exception { |
320 |
| - AbstractConfiguration config = ConfigurationManager.getConfigInstance(); |
321 |
| - config.setProperty("server.http.request.headers.read.timeout.enabled", true); |
322 |
| - config.setProperty("server.http.request.headers.read.timeout", 100); |
323 |
| - |
324 |
| - Socket slowClient = new Socket("localhost", ZUUL_SERVER_PORT); |
325 |
| - Thread.sleep(500); |
326 |
| - // end of stream reached because zuul closed the connection |
327 |
| - assertThat(slowClient.getInputStream().read()).isEqualTo(-1); |
328 |
| - slowClient.close(); |
329 |
| - } |
330 |
| - |
331 | 269 | @ParameterizedTest
|
332 | 270 | @MethodSource("arguments")
|
333 | 271 | void httpGetFailsDueToMalformedResponseChunk(
|
|
0 commit comments