@Override
    public AttributedList<Path> search(final Path workdir, final Filter<Path> filter, final ListProgressListener listener) throws BackgroundException {
        return session.getFeature(ListService.class).list(workdir, new SearchListProgressListener(filter, listener)).filter(filter);
    }
@Test
    public void testSearch() throws Exception {
        final Path workdir = new Path("/", EnumSet.of(Path.Type.directory));
        final Path f1 = new Path(workdir, "f1", EnumSet.of(Path.Type.file));
        final Path f2 = new Path(workdir, "f2", EnumSet.of(Path.Type.file));
        final DefaultSearchFeature feature = new DefaultSearchFeature(new NullSession(new Host(new TestProtocol())) {
            @Override
            public AttributedList<Path> list(final Path folder, final ListProgressListener listener) throws BackgroundException {
                if(folder.equals(workdir)) {
                    final AttributedList<Path> list = new AttributedList<>(Arrays.asList(f1, f2));
                    listener.chunk(folder, list);
                    return list;
                }
                return AttributedList.emptyList();
            }
        });
        final Filter<Path> filter = new NullFilter<Path>() {
            @Override
            public boolean accept(final Path file) {
                if(file.isDirectory()) {
                    return true;
                }
                return file.getName().equals("f1");
            }
        };
        final AttributedList<Path> search = feature.search(workdir, filter, new DisabledListProgressListener());
        assertTrue(search.contains(f1));
        assertFalse(search.contains(f2));
        assertEquals(1, search.size());
    }