@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        if(directory.isRoot()) {
            try {
                if(log.isDebugEnabled()) {
                    log.debug("Attempt to list available shares");
                }
                // An SRVSVC_HANDLE pointer that identifies the server.
                final RPCTransport transport = SMBTransportFactories.SRVSVC.getTransport(context);
                if(log.isDebugEnabled()) {
                    log.debug(String.format("Obtained transport %s", transport));
                }
                final ServerService lookup = new ServerService(transport);
                final List<NetShareInfo0> info = lookup.getShares0();
                if(log.isDebugEnabled()) {
                    log.debug(String.format("Retrieved share info %s", info));
                }
                final AttributedList<Path> result = new AttributedList<>();
                for(final String s : info.stream().map(NetShareInfo::getNetName).collect(Collectors.toSet())) {
                    final Path share = new Path(s, EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.volume));
                    try {
                        result.add(share.withAttributes(new SMBAttributesFinderFeature(session).find(share)));
                    }
                    catch(NotfoundException | AccessDeniedException | UnsupportedException e) {
                        if(log.isWarnEnabled()) {
                            log.warn(String.format("Skip unsupported share %s with failure %s", s, e));
                        }
                    }
                    listener.chunk(directory, result);
                }
                return result;
            }
            catch(SMB2Exception e) {
                if(log.isWarnEnabled()) {
                    log.warn(String.format("Failure %s getting share info from server", e));
                }
                final Credentials name = prompt.prompt(session.getHost(),
                        LocaleFactory.localizedString("SMB Share"),
                        LocaleFactory.localizedString("Enter the pathname to list:", "Goto"),
                        new LoginOptions().icon(session.getHost().getProtocol().disk()).keychain(false)
                                .passwordPlaceholder(LocaleFactory.localizedString("SMB Share"))
                                .password(false));
                if(log.isDebugEnabled()) {
                    log.debug(String.format("Connect to share %s from user input", name.getPassword()));
                }
                final Path share = new Path(name.getPassword(), EnumSet.of(Path.Type.directory, Path.Type.volume));
                final AttributedList<Path> result = new AttributedList<>(Collections.singleton(share.withAttributes(new SMBAttributesFinderFeature(session).find(share))));
                listener.chunk(directory, result);
                return result;
            }
            catch(IOException e) {
                throw new SMBTransportExceptionMappingService().map("Cannot read container configuration", e);
            }
        }
        return new SMBListService(session).list(directory, listener);
    }
@Test
    public void testListAllShares() throws Exception {
        final Path root = Home.ROOT;
        final AttributedList<Path> result = session.getFeature(ListService.class)/*SMBRootListService*/.list(root, new DisabledListProgressListener());
        for(Path f : result) {
            assertTrue(f.isVolume());
            assertNotEquals(TransferStatus.UNKNOWN_LENGTH, f.attributes().getSize());
            assertNotEquals(Quota.unknown, f.attributes().getQuota());
        }
        session.close();
    }