code: @Override
      public byte[] getResponseBody() throws IOException {
          if (this.responseBody == null) {
              InputStream instream = getResponseBodyAsStream();
              if (instream != null) {
                  long contentLength = getResponseContentLength();
                  if (contentLength > Integer.MAX_VALUE) { //guard below cast from overflow
                      throw new IOException("Content too large to be buffered: "+ contentLength +" bytes");
                  }
                  int limit = getParams().getIntParameter(HttpMethodParams.BUFFER_WARN_TRIGGER_LIMIT, 1024*1024);
                  if ((contentLength == -1) || (contentLength > limit)) {
                      LOG.warn("Going to buffer response body of large or unknown size. "
                              +"Using getResponseBodyAsStream instead is recommended.");
                  }
                  LOG.debug("Buffering response body");
                  ByteArrayOutputStream outstream = new ByteArrayOutputStream(
                          contentLength > 0 ? (int) contentLength : DEFAULT_INITIAL_BUFFER_SIZE);
                  byte[] buffer = new byte[4096];
                  int len;
                  while ((len = instream.read(buffer)) > 0) {
                      outstream.write(buffer, 0, len);
                  }
                  outstream.close();
                  setResponseStream(null);
                  this.responseBody = outstream.toByteArray();
              }
          }
          return this.responseBody;
      }
docs: Returns the response body of the HTTP method, if any, as an array of bytes.
  If response body is not available or cannot be read, returns <tt>null</tt>.
  Buffers the response and this method can be called several times yielding
  the same result each time.
  
  Note: This will cause the entire response body to be buffered in memory. A
  malicious server may easily exhaust all the VM memory. It is strongly
  recommended, to use getResponseAsStream if the content length of the response
  is unknown or resonably large.
  
  @return The response body.
  
  @throws IOException If an I/O (transport) problem occurs while obtaining the
  response body.