Source:
<code>protected void messageReceived(final ChannelHandlerContext ctx, final RawRequest rawRequest) throws Exception { final ArgScheme argScheme = ArgScheme.toScheme( <START> rawRequest.getTransportHeaders().getOrDefault(TransportHeaders.ARG_SCHEME_KEY, null) <END> ); if (argScheme == null) { throw new BadRequestError( "Missing `Arg Scheme` header", new Trace(0, 0, 0, (byte) 0), rawRequest.getId() ); } if (queuedRequests.get() >= maxQueuedRequests) { throw new BusyError( "Busy", new Trace(0, 0, 0, (byte) 0), rawRequest.getId() ); } queuedRequests.getAndIncrement(); String endpoint = this.serializer.decodeEndpoint(rawRequest); DefaultRequestHandler<?, ?> handler = this.requestHandlers.get(endpoint); if (handler == null) { throw new RuntimeException(String.format("No handler for %s", endpoint)); } Map<String, String> applicationHeaders = this.serializer.decodeHeaders(rawRequest); Object body = this.serializer.decodeBody(rawRequest, handler.getRequestType()); Request<?> request = new Request.Builder<>(body, rawRequest.getService(), endpoint) .setHeaders(applicationHeaders) .setTransportHeaders(rawRequest.getTransportHeaders()) .build(); ListenableFuture<Response<?>> responseFuture = listeningExecutorService.submit( new CallableHandler(handler, request)); Futures.addCallback(responseFuture, new FutureCallback<Response<?>>() { @Override public void onSuccess(Response<?> response) { queuedRequests.decrementAndGet(); RawResponse rawResponse = new RawResponse( rawRequest.getId(), response.getResponseCode(), rawRequest.getTransportHeaders(), serializer.encodeEndpoint(response.getEndpoint(), argScheme), serializer.encodeHeaders(response.getHeaders(), argScheme), serializer.encodeBody(response.getBody(), argScheme) ); ctx.writeAndFlush(rawResponse); } @Override public void onFailure(Throwable throwable) { } }); }</code><technical_language>java 1.8 I think</technical_language>

Target:
protected void messageReceived(final ChannelHandlerContext ctx, final RawRequest rawRequest) throws Exception { final ArgScheme argScheme = ArgScheme.toScheme( rawRequest.getTransportHeaders().get(TransportHeaders.ARG_SCHEME_KEY) ); if (argScheme == null) { throw new BadRequestError( "Missing `Arg Scheme` header", new Trace(0, 0, 0, (byte) 0), rawRequest.getId() ); } if (queuedRequests.get() >= maxQueuedRequests) { throw new BusyError( "Busy", new Trace(0, 0, 0, (byte) 0), rawRequest.getId() ); } queuedRequests.getAndIncrement(); String endpoint = this.serializer.decodeEndpoint(rawRequest); DefaultRequestHandler<?, ?> handler = this.requestHandlers.get(endpoint); if (handler == null) { throw new RuntimeException(String.format("No handler for %s", endpoint)); } Map<String, String> applicationHeaders = this.serializer.decodeHeaders(rawRequest); Object body = this.serializer.decodeBody(rawRequest, handler.getRequestType()); Request<?> request = new Request.Builder<>(body, rawRequest.getService(), endpoint) .setHeaders(applicationHeaders) .setTransportHeaders(rawRequest.getTransportHeaders()) .build(); ListenableFuture<Response<?>> responseFuture = listeningExecutorService.submit( new CallableHandler(handler, request)); Futures.addCallback(responseFuture, new FutureCallback<Response<?>>() { @Override public void onSuccess(Response<?> response) { queuedRequests.decrementAndGet(); RawResponse rawResponse = new RawResponse( rawRequest.getId(), response.getResponseCode(), rawRequest.getTransportHeaders(), serializer.encodeEndpoint(response.getEndpoint(), argScheme), serializer.encodeHeaders(response.getHeaders(), argScheme), serializer.encodeBody(response.getBody(), argScheme) ); ctx.writeAndFlush(rawResponse); } @Override public void onFailure(Throwable throwable) { } }); }