code: protected HttpResponse readInput() throws IOException {
          InputStream is = null;
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try {
              byte[] buffer = new byte[2048];
              try {
                  is = connection.getInputStream();
                  while (maxBytes == -1 || baos.size() < maxBytes) {
                      int bytesRead = is.read(buffer);
                      if (bytesRead == -1)
                          break;
                      baos.write(buffer, 0, bytesRead);
                  }
                  response = new HttpResponse(baos.toByteArray());
                  return response;
              }
              catch (IOException ex) {
                  InputStream eis = null;
                  try {
                      eis = connection.getErrorStream();
                      while (maxBytes == -1 || baos.size() < maxBytes) {
                          int bytesRead = eis.read(buffer);
                          if (bytesRead == -1)
                              break;
                          baos.write(buffer, 0, bytesRead);
                      }
                      response = new HttpResponse(baos.toByteArray());
                      return response;
                  }
                  catch (Exception ex2) {
                      // throw original exception
                  }
                  finally {
                      if (eis != null) {
                          eis.close();
                      }
                  }
                  throw ex;
              }
          }
          finally {
              if (is != null)
                  is.close();
              connection.disconnect();
              if (response != null) {
                response.setCode(connection.getResponseCode());
                response.setMessage(connection.getResponseMessage());
              }
              headers = new HashMap<String,String>();
              for (String headerKey : connection.getHeaderFields().keySet()) {
                  if (headerKey == null)
                      headers.put("HTTP", connection.getHeaderField(headerKey));
                  else
                      headers.put(headerKey, connection.getHeaderField(headerKey));
              }
          }
      }
docs: Populates the response member.  Closes the connection.