@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        final AttributedList<Path> result = new AttributedList<>();
        try {
            final SMBSession.DiskShareWrapper share = session.openShare(directory);
            final List<FileIdBothDirectoryInformation> info;
            try {
                info = share.get().list(new SMBPathContainerService(session).getKey(directory));
            }
            finally {
                session.releaseShare(share);
            }
            for(FileIdBothDirectoryInformation f : info) {
                final String filename = f.getFileName();
                if(filename.equals(".") || filename.equals("..")) {
                    if(log.isDebugEnabled()) {
                        log.debug(String.format("Skip %s", f.getFileName()));
                    }
                    continue;
                }
                final EnumSet<Type> type = EnumSet.noneOf(Type.class);
                long fileAttributes = f.getFileAttributes();
                // check for all relevant file types and add them to the EnumSet
                if((fileAttributes & FileAttributes.FILE_ATTRIBUTE_DIRECTORY.getValue()) != 0) {
                    type.add(Type.directory);
                }
                else {
                    type.add(Type.file);
                }
                final PathAttributes attr = new PathAttributes();
                attr.setAccessedDate(f.getLastAccessTime().toEpochMillis());
                attr.setModificationDate(f.getLastWriteTime().toEpochMillis());
                attr.setCreationDate(f.getCreationTime().toEpochMillis());
                attr.setSize(f.getEndOfFile());
                attr.setDisplayname(f.getFileName());
                result.add(new Path(directory, filename, type, attr));
                listener.chunk(directory, result);
            }
        }
        catch(SMBRuntimeException e) {
            throw new SMBExceptionMappingService().map("Listing directory {0} failed", e, directory);
        }
        return result;
    }
@Test
    public void testListShareNotfound() throws Exception {
        assertThrows(NotfoundException.class, () -> new SMBListService(session).list(
                new Path("/notfound", EnumSet.of(Path.Type.directory, Path.Type.volume)), new DisabledListProgressListener()));
    }