code: public final byte[] getContentBytes(HttpURLConnection connection, ByteArrayPool
              byteArrayPool)
              throws IOException {
          InputStream inputStream;
          try {
              inputStream = connection.getInputStream();
          } catch (IOException ioe) {
              inputStream = connection.getErrorStream();
              if(inputStream==null) {
                  throw ioe;
              }
          }
          return getContentBytes(inputStream, byteArrayPool, connection.getContentLength());
      }
docs: Reads the contents of HttpEntity into a byte[].