CompositeRequestHeaders implements RequestHeaderProvider<HttpURLConnection> { @Override public HttpURLConnection addHeaders(AdaptrisMessage msg, HttpURLConnection target) { HttpURLConnection http = target; for (RequestHeaderProvider<HttpURLConnection> h : getProviders()) { http = h.addHeaders(msg, http); } return http; } CompositeRequestHeaders();  CompositeRequestHeaders(RequestHeaderProvider<HttpURLConnection>... hdrs); @Override HttpURLConnection addHeaders(AdaptrisMessage msg, HttpURLConnection target); List<RequestHeaderProvider<HttpURLConnection>> getProviders(); void setProviders(List<RequestHeaderProvider<HttpURLConnection>> handlers); void addProvider(RequestHeaderProvider<HttpURLConnection> handler);  }
@Test public void testAddHeaders() throws Exception { Channel c = null; HttpURLConnection urlC = null; try { c = HttpHelper.createAndStartChannel(); URL url = new URL(HttpHelper.createProduceDestination(c).getDestination()); urlC = (HttpURLConnection) url.openConnection(); CompositeRequestHeaders headers = new CompositeRequestHeaders(); MetadataRequestHeaders meta = new MetadataRequestHeaders(); meta.setFilter(new RegexMetadataFilter()); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(""); String name = testName.getMethodName(); headers.addProvider(meta); msg.addMetadata(name, name); urlC = headers.addHeaders(msg, urlC); assertTrue(contains(urlC, name, name)); } finally { HttpHelper.stopChannelAndRelease(c); } }