public void set(String name, String value) {
        List<String> values = headers.get(name);
        if (values == null) {
            values = new ArrayList<>(1);
            headers.put(name, values);
        } else {
            values.clear();
        }
        values.add(value);
    }
@Test
    public void testSet() {
        HttpHeaders headers = new HttpHeaders(2);
        headers.set("Connection", "close");
        headers.set("Connection", "Keep-Alive");
        headers.set("Accept-Encoding", "gzip, deflate");

        Assert.assertEquals("Keep-Alive", headers.get("Connection"));
        Assert.assertEquals("gzip, deflate", headers.get("Accept-Encoding"));

        Assert.assertEquals(Collections.singletonList("Keep-Alive"), headers.getValues("Connection"));
        Assert.assertEquals(Collections.singletonList("gzip, deflate"), headers.getValues("Accept-Encoding"));
    }