DefaultHttpHeaderManager implements HttpHeaderManager { @Override public Enumeration<String> getHeaderNames() { List<String> names = new ArrayList<>(); Iterator<DefaultHttpHeader> iterator = headers.values().iterator(); while (iterator.hasNext()) { DefaultHttpHeader header = iterator.next(); names.add(header.getName()); } return Collections.enumeration(names); } DefaultHttpHeaderManager(); @Override void addHeader(String name, String value); @Override boolean containsHeader(String name); @Override long getDateHeader(String name); @Override String getHeader(String name); @Override Enumeration<String> getHeaderNames(); @Override Enumeration<String> getHeaders(String name); @Override int getIntHeader(String name); @Override void setHeader(String name, String value);  }
@Test void testGetHeaderNames() { DefaultHttpHeaderManager manager = new DefaultHttpHeaderManager(); manager.addHeader("NAME", "VALUE"); Enumeration<String> names = manager.getHeaderNames(); assertTrue(names.hasMoreElements()); assertEquals("NAME", names.nextElement()); }