holder.addSerializedContext(response, CTX_1_NAME, CTX_1_VAL, new BidirectionalTestContextSerializer());
return response;
}
private static void sendRequestAndAssert(HandlerHolder holder) throws Exception {
holder.correlator.onNewServerRequest(holder.requestId, new ContextsContainerImpl(holder.keySupplier));
try {
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "");
holder.addSerializedContext(request, CTX_1_NAME, CTX_1_VAL, new BidirectionalTestContextSerializer());
holder.handler.write(holder.ctx, request, holder.ctx.newPromise());
Assert.assertNotNull("Context container not set after request sent.",
ContextAttributeStorageHelper.getContainer(holder.ctx, holder.requestId));
ContextKeySupplier supplier = new HttpContextKeySupplier(request.headers());
ContextsContainer container = new ContextsContainerImpl(supplier);
Assert.assertEquals("Context not available in the container.", CTX_1_VAL, container.getContext(CTX_1_NAME));
Assert.assertEquals("Request Id header not added.", holder.getRequestId(),
request.headers().get(holder.getProvider().getRequestIdContextKeyName()));
} finally {
holder.correlator.onServerProcessingEnd(holder.requestId);
System.err.println("Sent server processing end callback to correlator.");