
this.closing = closing;
this.failing = failing;</BUG>
out = new FileOutputStream(file);
}
<BUG>@Override
public void received(Address address, ByteBuffer buffer) {
try {
out.write(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
} catch (IOException e) {
failing.failed(e);
}</BUG>
buffer.position(buffer.position() + buffer.remaining());

import java.nio.ByteBuffer;
public final class ToFileReceiverClosing implements Connection, Disconnectable {
private final OutputStream out;
private final Connection wrappee;
private boolean closed = false;
public ToFileReceiverClosing(File file, Connection wrappee) throws IOException {
this.wrappee = wrappee;
out = new FileOutputStream(file);
