if (currentOutBuffer.remaining() != 0)
flush();
if (currentOutBuffer.remaining() == 0) {
currentOutBuffer = new CopyDone().toBytes();
if (state == ConnectionState.NewCopyInState)
state = ConnectionState.NewCopyDone;
if (state == ConnectionState.NewExtendedCopyInState)
state = ConnectionState.NewExtendedCopyDone;
consumeInput(); // call consume input to change the state if possible