|
13 | 13 | package org.asynchttpclient;
|
14 | 14 |
|
15 | 15 | import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
|
16 |
| -import static java.nio.charset.StandardCharsets.UTF_8; |
17 | 16 | import static org.asynchttpclient.Dsl.*;
|
18 | 17 | import static org.asynchttpclient.test.TestUtils.*;
|
19 | 18 |
|
@@ -72,17 +71,15 @@ private class IncompleteResponseHandler extends AbstractHandler {
|
72 | 71 |
|
73 | 72 | public void handle(String s, Request r, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
74 | 73 | // NOTE: handler sends less bytes than are given in Content-Length, which should lead to timeout
|
75 |
| - |
| 74 | + response.setStatus(200); |
76 | 75 | OutputStream out = response.getOutputStream();
|
77 |
| - if (request.getHeader("X-Content") != null) { |
78 |
| - String content = request.getHeader("X-Content"); |
79 |
| - response.setHeader(CONTENT_LENGTH.toString(), String.valueOf(content.getBytes(UTF_8).length)); |
80 |
| - out.write(content.substring(1).getBytes(UTF_8)); |
81 |
| - } else { |
82 |
| - response.setStatus(200); |
83 |
| - } |
| 76 | + response.setIntHeader(CONTENT_LENGTH.toString(), 1000); |
| 77 | + out.write(0); |
84 | 78 | out.flush();
|
85 |
| - out.close(); |
| 79 | + try { |
| 80 | + Thread.sleep(LONG_FUTURE_TIMEOUT + 100); |
| 81 | + } catch (InterruptedException e) { |
| 82 | + } |
86 | 83 | }
|
87 | 84 | }
|
88 | 85 |
|
@@ -172,7 +169,7 @@ protected Future<Response> execute(AsyncHttpClient client, boolean basic, boolea
|
172 | 169 | }
|
173 | 170 | }
|
174 | 171 |
|
175 |
| - return client.prepareGet(url).setRealm(realm.setUsePreemptiveAuth(preemptive).build()).setHeader("X-Content", "Test").execute(); |
| 172 | + return client.prepareGet(url).setRealm(realm.setUsePreemptiveAuth(preemptive).build()).execute(); |
176 | 173 | }
|
177 | 174 |
|
178 | 175 | @Override
|
|
0 commit comments