@Override
    public StatusOutputStream<BaseB2Response> write(final Path file, final TransferStatus status, final ConnectionCallback callback) {
        final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status);
        return new HttpResponseOutputStream<BaseB2Response>(new MemorySegementingOutputStream(proxy,
                new HostPreferences(session.getHost()).getInteger("b2.upload.largeobject.size.minimum")),
                new B2AttributesFinderFeature(session, fileid), status) {
            @Override
            public BaseB2Response getStatus() {
                return proxy.getFinishLargeFileResponse();
            }
        };
    }
@Test
    public void testWrite() throws Exception {
        final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
        final B2LargeUploadWriteFeature feature = new B2LargeUploadWriteFeature(session, fileid);
        final Path container = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final TransferStatus status = new TransferStatus();
        status.setLength(-1L);
        status.setModified(1503654614004L);
        final Path file = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        final StatusOutputStream<BaseB2Response> out = feature.write(file, status, new DisabledConnectionCallback());
        final byte[] content = RandomUtils.nextBytes(6 * 1024 * 1024);
        final ByteArrayInputStream in = new ByteArrayInputStream(content);
        assertEquals(content.length, IOUtils.copy(in, out));
        in.close();
        out.close();
        assertEquals(content.length, ((B2FinishLargeFileResponse) out.getStatus()).getContentLength(), 0L);
        assertTrue(new B2FindFeature(session, fileid).find(file));
        final byte[] compare = new byte[content.length];
        final InputStream stream = new B2ReadFeature(session, fileid).read(file, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
        IOUtils.readFully(stream, compare);
        stream.close();
        assertArrayEquals(content, compare);
        assertEquals(1503654614004L, new B2AttributesFinderFeature(session, fileid).find(file).getModificationDate());
        new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }