@Test public void testSetTarget() { assertEquals("s3.dualstack.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "s3.dualstack.eu-west-1.amazonaws.com").getTarget()); assertEquals("s3.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "s3.eu-west-1.amazonaws.com").getTarget()); assertEquals("cyberduck.s3.dualstack.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "cyberduck.s3.dualstack.eu-west-1.amazonaws.com").getTarget()); assertEquals("cyberduck.s3.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "cyberduck.s3.eu-west-1.amazonaws.com").getTarget()); assertEquals("duck.s3.dualstack.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "cyber.duck.s3.dualstack.eu-west-1.amazonaws.com").getTarget()); assertEquals("duck.s3.eu-west-1.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "cyber.duck.s3.eu-west-1.amazonaws.com").getTarget()); assertEquals("duck.s3.amazonaws.com", new S3BucketHostnameTrustManager(new DisabledX509TrustManager(), "cyber.duck.s3.amazonaws.com").getTarget()); }
@Override public String getTarget() { final String hostname = super.getTarget(); final Matcher matcher = pattern.matcher(hostname); if(matcher.matches()) { final String simple = matcher.group(2); log.warn(String.format("Rewrite hostname target to %s", simple)); return simple; } return hostname; }
S3BucketHostnameTrustManager extends ThreadLocalHostnameDelegatingTrustManager { @Override public String getTarget() { final String hostname = super.getTarget(); final Matcher matcher = pattern.matcher(hostname); if(matcher.matches()) { final String simple = matcher.group(2); log.warn(String.format("Rewrite hostname target to %s", simple)); return simple; } return hostname; } }
S3BucketHostnameTrustManager extends ThreadLocalHostnameDelegatingTrustManager { @Override public String getTarget() { final String hostname = super.getTarget(); final Matcher matcher = pattern.matcher(hostname); if(matcher.matches()) { final String simple = matcher.group(2); log.warn(String.format("Rewrite hostname target to %s", simple)); return simple; } return hostname; } S3BucketHostnameTrustManager(final X509TrustManager delegate, final String hostname); }
S3BucketHostnameTrustManager extends ThreadLocalHostnameDelegatingTrustManager { @Override public String getTarget() { final String hostname = super.getTarget(); final Matcher matcher = pattern.matcher(hostname); if(matcher.matches()) { final String simple = matcher.group(2); log.warn(String.format("Rewrite hostname target to %s", simple)); return simple; } return hostname; } S3BucketHostnameTrustManager(final X509TrustManager delegate, final String hostname); @Override String getTarget(); }
S3BucketHostnameTrustManager extends ThreadLocalHostnameDelegatingTrustManager { @Override public String getTarget() { final String hostname = super.getTarget(); final Matcher matcher = pattern.matcher(hostname); if(matcher.matches()) { final String simple = matcher.group(2); log.warn(String.format("Rewrite hostname target to %s", simple)); return simple; } return hostname; } S3BucketHostnameTrustManager(final X509TrustManager delegate, final String hostname); @Override String getTarget();  }