@Override
    public Path mkdir(final Path folder, final TransferStatus status) throws BackgroundException {
        try {
            if(containerService.isContainer(folder)) {
                // Create container at top level
                session.getClient().createContainer(regionService.lookup(
                    new SwiftLocationFeature.SwiftRegion(status.getRegion())), folder.getName());
                return folder;
            }
            else {
                status.setMime(DIRECTORY_MIME_TYPE);
                status.setLength(0L);
                new DefaultStreamCloser().close(writer.write(folder, status, new DisabledConnectionCallback()));
                return folder.withAttributes(status.getResponse());
            }
        }
        catch(GenericException e) {
            throw new SwiftExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
    }
@Test
    public void testCreateContainer() throws Exception {
        final SwiftDirectoryFeature feature = new SwiftDirectoryFeature(session, new SwiftRegionService(session), new SwiftWriteFeature(session, new SwiftRegionService(session)));
        final Path test = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
        final Path container = feature.mkdir(test, new TransferStatus().withRegion("ORD"));
        assertTrue(new SwiftFindFeature(session).find(container));
        // Can create again regardless if exists
        feature.mkdir(test, new TransferStatus());
        new SwiftDeleteFeature(session).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new SwiftFindFeature(session).find(container));
    }