@Override
    public void write(IApimanBuffer chunk) {
        if (finished) {
            throw new IllegalStateException("Attempted write after #end() was called."); //$NON-NLS-1$
        }

        if (headPolicyHandler != null) {
            headPolicyHandler.write(chunk);
        } else {
            handleBody(chunk);
        }
    }
@see io.apiman.gateway.engine.io.AbstractStream#write(io.apiman.gateway.engine.io.IApimanBuffer)
gateway/engine/core/src/main/java/io/apiman/gateway/engine/policy/Chain.java