| 403 | Client client = new DefaultClient(null, null); |
| 404 | |
| 405 | @Override |
| 406 | public Response execute(Request request, Request.Options options) |
| 407 | throws IOException { |
| 408 | final Response original = client.execute(request, options); |
| 409 | return Response.builder() |
| 410 | .status(original.status()) |
| 411 | .headers(original.headers()) |
| 412 | .reason(original.reason()) |
| 413 | .request(original.request()) |
| 414 | .body( |
| 415 | new Response.Body() { |
| 416 | @Override |
| 417 | public Integer length() { |
| 418 | return original.body().length(); |
| 419 | } |
| 420 | |
| 421 | @Override |
| 422 | public boolean isRepeatable() { |
| 423 | return original.body().isRepeatable(); |
| 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public InputStream asInputStream() throws IOException { |
| 428 | return original.body().asInputStream(); |
| 429 | } |
| 430 | |
| 431 | @SuppressWarnings("deprecation") |
| 432 | @Override |
| 433 | public Reader asReader() throws IOException { |
| 434 | return original.body().asReader(Util.UTF_8); |
| 435 | } |
| 436 | |
| 437 | @Override |
| 438 | public Reader asReader(Charset charset) throws IOException { |
| 439 | return original.body().asReader(charset); |
| 440 | } |
| 441 | |
| 442 | @Override |
| 443 | public void close() throws IOException { |
| 444 | closed.set(true); |
| 445 | original.body().close(); |
| 446 | } |
| 447 | }) |
| 448 | .build(); |
| 449 | } |
| 450 | }) |
| 451 | .decoder(angryDecoder) |
| 452 | .doNotCloseAfterDecode() |