if (isPrimarySinkClosed.get()) {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, buffer);
} else {
throw new ClosedChannelException();
}
} else {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, buffer.duplicate());
}