code: private HttpCode readStatusLine() throws IOException {
          // Read a line of text, which should be in the format HTTP/<version <code> <reason>
          String statusLine = readHeader();
          String[] parts = statusLine.split(" +");
          if (parts.length < 3) {
              throw new IOException("Badly formed response status line: " + statusLine);
          }
          try {
              // Attempt to convert the return code into an enum.
              int code = Integer.parseInt(parts[1]);
              HttpCode result = HttpCode.findByCode(code);
              if (result == null) {
                  throw new IOException("Unrecognized result code: " + code);
              }
              return result;
          } catch (NumberFormatException e) {
              // Turn into a bad response line error.
              throw new IOException("Badly formed response status line: " + statusLine);
          }
      }
docs: Read a REST response status line and return the status code from it.