protected HttpUriRequest setupConnection(final String method, final String bucketName,
                                             final String objectKey, final Map<String, String> requestParameters) throws S3ServiceException {
        return this.setupConnection(HTTP_METHOD.valueOf(method), bucketName, objectKey, requestParameters);
    }
@Test
    public void testSetupConnection() throws Exception {
        final RequestEntityRestStorageService service = new RequestEntityRestStorageService(session, new HttpConnectionPoolBuilder(session.getHost(),
                new ThreadLocalHostnameDelegatingTrustManager(new DisabledX509TrustManager(), session.getHost().getHostname()),
                new DefaultX509KeyManager(), new DisabledProxyFinder()).build(new DisabledProxyFinder(), new DisabledTranscriptListener(), new DisabledLoginCallback()));
        final RegionEndpointCache cache = service.getRegionEndpointCache();
        cache.clear();
        final String key = new AlphanumericRandomStringService().random();
        {
            final HttpUriRequest request = service.setupConnection("GET", "test-eu-central-1-cyberduck", key, Collections.emptyMap());
            assertEquals(String.format("https://test-eu-central-1-cyberduck.s3.dualstack.eu-central-1.amazonaws.com:443/%s", key), request.getURI().toString());
        }
        cache.clear();
        {
            final HttpUriRequest request = service.setupConnection("HEAD", "test-eu-central-1-cyberduck", key, Collections.singletonMap("location", ""));
            assertEquals(String.format("https://test-eu-central-1-cyberduck.s3.amazonaws.com:443/%s?location=", key), request.getURI().toString());
        }
    }