code: public static HeaderFields wrap(String msgstr) throws ParseException {
          HeaderFields header = new HeaderFields();
          if (msgstr.isEmpty()) {
              return header;
          }
          String[] entries = msgstr.split("\n");
          for (String entry : entries) {
              if (entry.trim().isEmpty()) {
                  log.warn("Empty header is found. This entry will be ignored.");
                  continue;
              }
              String[] keyval = entry.split("\\:", 2);
              if (keyval.length != 2) {
                  log.warn(
                          "Header entry is not key:value pair [{}]. It will be ignored.",
                          entry);
                  continue;
              }
              header.entries.put(keyval[0].trim(), keyval[1].trim());
          }
          return header;
      }
docs: <p>
  Extracts key:value headers into a {@link HeaderFields}.
  </p>
  
  <p>
  The expected format is zero or more lines each in the form
  <code> "[key]:[value]\n"</code>.
  </p>
  <p>
  Other format will be ignored with a warning. i.e. <code>"\n"</code>
  <code>"key\n"</code>
  </p>
  
  @param msgstr
  string describing one or more headers