@Override
    public Set<String> names() {
        if (isEmpty()) {
            return Collections.emptySet();
        }
        Set<String> names = new LinkedHashSet<String>(size());
        for (int i = 0; i < nameValuePairs.length; i += 2) {
            names.add(nameValuePairs[i].toString());
        }
        return names;
    }
@Test
    public void names() {
        ReadOnlyHttpHeaders headers = new ReadOnlyHttpHeaders(true,
                ACCEPT, APPLICATION_JSON, CONTENT_LENGTH, ZERO, CONNECTION, CLOSE);
        assertFalse(headers.isEmpty());
        assertEquals(3, headers.size());
        Set<String> names = headers.names();
        assertEquals(3, names.size());
        assertTrue(names.contains(ACCEPT.toString()));
        assertTrue(names.contains(CONTENT_LENGTH.toString()));
        assertTrue(names.contains(CONNECTION.toString()));
    }