public static String findBucketInHostname(final Host host) {
        if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) {
            if(log.isDebugEnabled()) {
                log.debug(String.format("No default hostname set in %s", host.getProtocol()));
            }
            return null;
        }
        final String hostname = host.getHostname();
        if(hostname.equals(host.getProtocol().getDefaultHostname())) {
            return null;
        }
        if(hostname.endsWith(host.getProtocol().getDefaultHostname())) {
            if(log.isDebugEnabled()) {
                log.debug(String.format("Find bucket name in %s", hostname));
            }
            return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname());
        }
        return null;
    }
@Test
    public void testGetBucket() {
        assertEquals("bucketname", RequestEntityRestStorageService.findBucketInHostname(new Host(new S3Protocol(), "bucketname.s3.amazonaws.com")));
        assertNull(RequestEntityRestStorageService.findBucketInHostname(new Host(new TestProtocol(), "bucketname.s3.amazonaws.com")));
    }