@Override
    public List<TransferItem> list(final Session<?> session, final Path directory, final Local local,
                                   final ListProgressListener listener) throws BackgroundException {
        if(log.isDebugEnabled()) {
            log.debug(String.format("List children for %s", directory));
        }
        final AttributedList<Path> list = session.getFeature(ListService.class).list(directory, listener).filter(comparator, filter);
        final Path copy = mapping.get(directory);
        for(Path f : list) {
            mapping.put(f, new Path(copy, f.getName(), EnumSet.of(f.isDirectory() ? Path.Type.directory : Path.Type.file)));
        }
        final List<TransferItem> nullified = new ArrayList<>();
        for(Path p : list) {
            nullified.add(new TransferItem(p));
        }
        return nullified;
    }
@Test
    public void testList() throws Exception {
        Transfer t = new CopyTransfer(new Host(new TestProtocol()),
                new Host(new TestProtocol()), new HashMap<>(Collections.singletonMap(
                new Path("/s", EnumSet.of(Path.Type.directory)),
                new Path("/t", EnumSet.of(Path.Type.directory)))));
        final NullSession session = new NullSession(new Host(new TestProtocol())) {
            @Override
            public AttributedList<Path> list(final Path file, final ListProgressListener listener) {
                final AttributedList<Path> children = new AttributedList<>();
                children.add(new Path("/s/c", EnumSet.of(Path.Type.file)));
                return children;
            }
        };
        assertEquals(Collections.singletonList(new TransferItem(new Path("/s/c", EnumSet.of(Path.Type.file)))),
            t.list(session, new Path("/s", EnumSet.of(Path.Type.directory)), null, new DisabledListProgressListener())
        );
    }