Assert.assertSame("Unexpected request Id in the context.", requestId, ids.poll());
}
@Test
public void testBeforeServerResponse() throws Exception {
RequestIdProvider provider = new HttpRequestIdProvider(REQUEST_ID_HEADER_NAME, CORRELATOR);
AttributeMap attributeMap = new DefaultAttributeMap();
MapBackedKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
String expectedId1 = "hellothere1";
String expectedId2 = "hellothere2";
String expectedId3 = "hellothere3";
// Simulate HTTP pipelining
onServerRequest(provider, attributeMap, keySupplier, expectedId1);
onServerRequest(provider, attributeMap, keySupplier, expectedId2);
onServerRequest(provider, attributeMap, keySupplier, expectedId3);
Assert.assertSame("Unexpected 1st request Id", expectedId1,
provider.beforeServerResponse(keySupplier, attributeMap));
Assert.assertSame("Unexpected 2nd request Id", expectedId2,
provider.beforeServerResponse(keySupplier, attributeMap));
Assert.assertSame("Unexpected 3rd request Id", expectedId3,
provider.beforeServerResponse(keySupplier, attributeMap));
}