code: private void parse(InputStream in) throws IOException {
          Pattern p = Pattern.compile(":");
          BufferedReader bin = new BufferedReader(new InputStreamReader(in), 1);
          String currLine = bin.readLine();
          //command = currLine;
  
          //parse the command to get the request method
          parseCommand(currLine);
  
          //parse headers
          currLine = bin.readLine();
          while (currLine != null) {
  
              if (Utils.isEmpty(currLine)) {
                  break;  //we have reached the end of the headers
              }
  
              //split the headers into name-value pairs
              String[] split = currLine.split(": ");
              
              if (split.length < 2) {
                  split = new String[] {
                      split[0], ""
                  };
              }
  
              String headerName = Utils.trim(split[0]);
              String headerValue = Utils.trim(split[1]);
  
              headers.put(headerName, headerValue);
  
              currLine = bin.readLine();
          }
  
          //parse the POST body, if there is one
          if (currLine != null) {
              StringBuilder bodyBuilder = new StringBuilder();
              while ((currLine = bin.readLine()) != null) {
                  bodyBuilder.append(currLine).append("\n");
              }
              body = bodyBuilder.toString();
          }
  
      }
docs: Parses an http message from an input stream. The first line of input is
  save in the protected <tt>command</tt> variable. The subsequent lines are
  put into a linked hash as field/value pairs. Input is parsed until a
  blank line is reached, after which any data should appear.
  
  @param in An InputStream containing a valid HTTP message