public Integer handleResponse(Response response) throws Exception {
    try {
      int status = response.getStatus();

      sres.setStatus(status);
      sres.setContentType(response.getContentType(true));

      response.enumerateHeaders(
          new Response.HeaderEnumerator() {
            public void header(String name, String value) {
              sres.addHeader(name, value);
            }
          });

      if ((status >= 100 && status <= 199) || status == 204 || status == 205 || status == 304) {
        // No body
      } else {
        if (response.isBuffered()) {
          // Output Content-Length header, if size is known
          setContentLength(sres, response.getContentLength());
        }

        // Output body
        response.writeResult(sres.getOutputStream());
      }

      return 0;
    } catch (IOException ex) {
      // If we fail to send response, it's probably just because
      // nobody is listening anyway.
      return 20;
    } finally {
      sres.flushBuffer();
    }
  }