@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        try {
            final int response = session.getClient().stat(directory.getAbsolute());
            if(FTPReply.isPositiveCompletion(response)) {
                return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()));
            }
            else {
                throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
            }
        }
        catch(IOException e) {
            throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory);
        }
    }
@Test
    public void testList() throws Exception {
        final ListService service = new FTPStatListService(session,
            new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())));
        final Path directory = new FTPWorkdirService(session).find();
        final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        new FTPTouchFeature(session).touch(file, new TransferStatus());
        final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener());
        assertTrue(list.contains(file));
        new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }