@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        try {
            final AttributedList<Path> buckets = new AttributedList<>();
            Buckets response;
            String page = null;
            do {
                final Storage.Buckets.List request = session.getClient().buckets().list(session.getHost().getCredentials().getUsername())
                        .setMaxResults(new HostPreferences(session.getHost()).getLong("googlestorage.listing.chunksize"))
                        .setPageToken(page);
                response = request.execute();
                if(null != response.getItems()) {
                    for(Bucket item : response.getItems()) {
                        final Path bucket = new Path(PathNormalizer.normalize(item.getName()), EnumSet.of(Path.Type.volume, Path.Type.directory),
                                attributes.toAttributes(item)
                        );
                        buckets.add(bucket);
                        listener.chunk(directory, buckets);
                    }
                }
                page = response.getNextPageToken();
            }
            while(page != null);
            return buckets;
        }
        catch(IOException e) {
            throw new GoogleStorageExceptionMappingService().map("Listing directory {0} failed", e, directory);
        }
    }
@Test
    public void testListContainers() throws Exception {
        final Path container = new Path("/", EnumSet.of(Path.Type.directory));
        final AttributedList<Path> list = new GoogleStorageBucketListService(session).list(container, new DisabledListProgressListener());
        assertFalse(list.isEmpty());
        for(Path bucket : list) {
            assertEquals(bucket.attributes(), new GoogleStorageAttributesFinderFeature(session).find(bucket, new DisabledListProgressListener()));
        }
    }