public static Map<String, String> mergeHeaders(Map<String, String> headers1, Map<String, String> headers2)
  {
    TreeMap<String, String> combinedHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    if (headers2 != null)
    {
      combinedHeaders.putAll(headers2);
    }
    if (headers1 != null)
    {
      for (Map.Entry<String, String> header : headers1.entrySet())
      {
        String name = header.getKey();
        if (!combinedHeaders.containsKey(name))
        {
          combinedHeaders.put(name, header.getValue());
        }
      }
    }
    return combinedHeaders;
  }
@Test
  public void testMergeHeader()
  {
    Map<String, String> headers1 = new HashMap<>();
    Map<String, String> headers2 = new HashMap<>();
    headers1.put("X-header1", "header1Value");
    headers1.put("X-commonheader", "commonHeader1Value");
    headers2.put("X-header2", "header2Value");
    headers2.put("X-CommonHeader", "commonHeader2Value");

    Map<String, String> combineHeaders = HeaderUtil.mergeHeaders(headers1, headers2);

    Assert.assertEquals(combineHeaders.size(), 3);
    Assert.assertEquals(combineHeaders.get("x-header1"), "header1Value");
    Assert.assertEquals(combineHeaders.get("x-header2"), "header2Value");
    Assert.assertEquals(combineHeaders.get("x-commonheader"), "commonHeader2Value");
  }