} else if (available == 0) {
if (isPrimarySinkClosed.get()) {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, NULL_BYTE_BUFFER);
} else {
throw new ClosedChannelException();
}
} else {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, NULL_BYTE_BUFFER);
}
write(primarySink, isPrimarySinkClosed, NULL_BYTE_BUFFER);
}
} else if (available > 0) {
ByteBuffer[] buffers = HttpClientConnection.readByteBufferByLengthSilence(bodyDataSource, available);
for (ByteBuffer buffer : buffers) {
if (isPrimarySinkClosed.get()) {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, buffer);
} else {
throw new ClosedChannelException();
}
} else {
if (!isSecondarySinkClosed.get()) {
write(secondarySink, isSecondarySinkClosed, buffer.duplicate());
}