public void create(final Path bucket, final String region) throws BackgroundException {
        if(log.isDebugEnabled()) {
            log.debug(String.format("Create bucket %s in region %s", bucket, region));
        }
        if(!new HostPreferences(session.getHost()).getBoolean("s3.bucket.virtualhost.disable")) {
            if(!ServiceUtils.isBucketNameValidDNSName(bucket.getName())) {
                throw new InteroperabilityException(LocaleFactory.localizedString("Bucket name is not DNS compatible", "S3"));
            }
        }
        AccessControlList acl;
        if(new HostPreferences(session.getHost()).getProperty("s3.acl.default").equals("public-read")) {
            acl = AccessControlList.REST_CANNED_PUBLIC_READ;
        }
        else {
            acl = AccessControlList.REST_CANNED_PRIVATE;
        }
        try {
            if(StringUtils.isNotBlank(region)) {
                if(S3Session.isAwsHostname(session.getHost().getHostname())) {
                    // Adjust default region to be used when searching for existing bucket will return 404
                    session.getHost().setProperty("s3.location", region);
                }
            }
            else {
                log.warn("Missing region for bucket location");
            }
            // Create bucket
            session.getClient().createBucket(URIEncoder.encode(containerService.getContainer(bucket).getName()),
                    S3LocationFeature.DEFAULT_REGION.getIdentifier().equals(region) ? "US" : region, acl);
        }
        catch(ServiceException e) {
            throw new S3ExceptionMappingService().map("Cannot create folder {0}", e, bucket);
        }
    }
@Test
    public void testCreateBucket() throws Exception {
        final AtomicBoolean header = new AtomicBoolean();
        session.withListener(new TranscriptListener() {
            @Override
            public void log(final Type request, final String message) {
                if(StringUtils.contains(message, "Expect: 100-continue")) {
                    header.set(true);
                }
            }
        });
        final S3BucketCreateService create = new S3BucketCreateService(session);
        final Path bucket = new Path(new AsciiRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume));
        create.create(bucket, "eu-central-1");
        assertTrue(header.get());
        bucket.attributes().setRegion("eu-central-1");
        assertTrue(new S3FindFeature(session, new S3AccessControlListFeature(session)).find(bucket));
        new S3DefaultDeleteFeature(session).delete(Collections.singletonList(bucket), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }