private static ConduitWrapper<StreamSinkConduit> responseWrapper(final boolean requestLooksPersistent) {
return new ConduitWrapper<StreamSinkConduit>() {
public StreamSinkConduit wrap(final ConduitFactory<StreamSinkConduit> factory, final HttpServerExchange exchange) {
if(exchange.getRequestMethod().equals(Methods.HEAD)) {
return new HeadStreamSinkConduit(factory.create(), terminateResponseListener(exchange));
}
final StreamSinkConduit channel = factory.create();
final HeaderMap responseHeaders = exchange.getResponseHeaders();
// test to see if we're still persistent
boolean stillPersistent = requestLooksPersistent && exchange.isPersistent();