@Override
    public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
        try {
            final FileAttributes attrs;
            if(Permission.EMPTY != status.getPermission()) {
                attrs = new FileAttributes.Builder().withPermissions(Integer.parseInt(status.getPermission().getMode(), 8)).build();
            }
            else {
                attrs = FileAttributes.EMPTY;
            }
            final RemoteFile handle = session.sftp().open(file.getAbsolute(),
                    EnumSet.of(OpenMode.CREAT, OpenMode.TRUNC, OpenMode.WRITE), attrs);
            handle.close();
        }
        catch(IOException e) {
            throw new SFTPExceptionMappingService().map("Cannot create {0}", e, file);
        }
        return file;
    }
@Test
    public void testTouch() throws Exception {
        final Path home = new SFTPHomeDirectoryService(session).find();
        final Path test = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        new SFTPTouchFeature(session).touch(test, new TransferStatus());
        new SFTPUnixPermissionFeature(session).setUnixPermission(test, new Permission("664"));
        // Test override
        new SFTPTouchFeature(session).touch(test, new TransferStatus());
        final AttributedList<Path> list = new SFTPListService(session).list(home, new DisabledListProgressListener());
        assertTrue(list.contains(test));
        assertEquals("664", list.get(test).attributes().getPermission().getMode());
        new SFTPDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }