I have written a StreamSinkConduit which buffers content in a pooled buffer. I am having an issue with AbstractFixedLengthStreamSinkConduit throwing a FixedLengthUnderflowException exception. 

If I have content left in my buffer which I have not yet been able to write to the next conduit when terminateWrites is called, the exception is thrown. Even though this content would have been written in the subsequent call to flush. Shouldn't the bytes remaining be checked after a successful flush rather than in terminateWrites? Or am I missing something?

For the time being I am flushing my local buffer in terminateWrites, but this seems wrong!