@Override
    public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
        try {
            if(!session.getClient().setFileType(FTP.BINARY_FILE_TYPE)) {
                throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
            }
            if(status.isAppend()) {
                session.getClient().setRestartOffset(status.getOffset());
            }
            final InputStream in = new DataConnectionActionExecutor(session).data(new DataConnectionAction<InputStream>() {
                @Override
                public InputStream execute() throws BackgroundException {
                    try {
                        return session.getClient().retrieveFileStream(file.getAbsolute());
                    }
                    catch(IOException e) {
                        throw new FTPExceptionMappingService().map(e);
                    }
                }
            });
            return new ReadReplyInputStream(in, status);
        }
        catch(IOException e) {
            throw new FTPExceptionMappingService().map("Download {0} failed", e, file);
        }
    }
@Test
    public void testAbortPartialRead() throws Exception {
        final Path test = new Path(new FTPWorkdirService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        new FTPTouchFeature(session).touch(test, new TransferStatus());
        final OutputStream out = new FTPWriteFeature(session).write(test, new TransferStatus().withLength(20L), new DisabledConnectionCallback());
        assertNotNull(out);
        final byte[] content = RandomUtils.nextBytes(2048);
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out);
        out.close();
        final TransferStatus status = new TransferStatus();
        status.setLength(20L);
        final Path workdir = new FTPWorkdirService(session).find();
        final InputStream in = new FTPReadFeature(session).read(test, status, new DisabledConnectionCallback());
        assertNotNull(in);
        assertTrue(in.read() > 0);
        // Send ABOR because stream was not read completly
        in.close();
        // Make sure subsequent PWD command works
        assertEquals(workdir, new FTPWorkdirService(session).find());
        new FTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }