@SuppressWarnings("try") @Override public void close(final CompletionHandler completionHandler) { try (final ResourceReference ref = requestReference) { final byte[] requestContentBytes = accumulatedRequestContent.toByteArray(); final String content = new String(requestContentBytes, contentCharset); completionHandler.completed(); final Map<String, List<String>> parameterMap = parseFormParameters(content); mergeParameters(parameterMap, request.parameters()); final ContentChannel contentChannel = delegateHandler.handleRequest(request, responseHandler); if (contentChannel != null) { if (!removeBody) { final ByteBuffer byteBuffer = ByteBuffer.wrap(requestContentBytes); contentChannel.write(byteBuffer, NOOP_COMPLETION_HANDLER); } contentChannel.close(NOOP_COMPLETION_HANDLER); } } }