@Override
    public void setUnixPermission(final Path file, final TransferStatus status) throws BackgroundException {
        if(failure != null) {
            if(log.isDebugEnabled()) {
                log.debug(String.format("Skip setting permission for %s due to previous failure %s", file, failure.getMessage()));
            }
            throw failure;
        }
        try {
            if(!session.getClient().sendSiteCommand(String.format("CHMOD %s %s", status.getPermission().getMode(), file.getAbsolute()))) {
                throw new FTPException(session.getClient().getReplyCode(),
                        session.getClient().getReplyString());
            }
        }
        catch(IOException e) {
            throw failure = new FTPExceptionMappingService().map("Cannot change permissions of {0}", e, file);
        }
    }
@Test(expected = InteroperabilityException.class)
    public void testSetUnixPermission() throws Exception {
        final FTPWorkdirService workdir = new FTPWorkdirService(session);
        final Path home = workdir.find();
        final Path test = new Path(home, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        new FTPTouchFeature(session).touch(test, new TransferStatus());
        new FTPUnixPermissionFeature(session).setUnixPermission(test, new Permission(666));
        assertEquals("666", new FTPListService(session, null, TimeZone.getDefault()).list(home, new DisabledListProgressListener()).get(test).attributes().getPermission().getMode());
        new FTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }