code: protected static Map<String, String> convertHeaders(Header[] headers) {
          Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
          for (int i = 0; i < headers.length; i++) {
              result.put(headers[i].getName(), headers[i].getValue());
          }
          return result;
      }
docs: Converts Headers[] to Map<String, String>.