@Test public void testHostnameVerificationDisabled() { final HostnameVerifierProvider provider = new HostnameVerifierProvider(false, delegate); final HostnameVerifier verifier = provider.verifierFor("any.host"); assertTrue(verifier.verify("example.com", sslSession)); verifyNoMoreInteractions(delegate, sslSession); }
public HostnameVerifier verifierFor(String hostname) { if (!hostnameVerificationEnabled) { log.debug("hostname verification disabled"); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return true; } }; } final String tHostname = hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname; log.debug("configuring DefaultHostnameVerifier to expect hostname={}", tHostname); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return delegate.verify(tHostname, sslSession); } }; }
HostnameVerifierProvider { public HostnameVerifier verifierFor(String hostname) { if (!hostnameVerificationEnabled) { log.debug("hostname verification disabled"); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return true; } }; } final String tHostname = hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname; log.debug("configuring DefaultHostnameVerifier to expect hostname={}", tHostname); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return delegate.verify(tHostname, sslSession); } }; } }
HostnameVerifierProvider { public HostnameVerifier verifierFor(String hostname) { if (!hostnameVerificationEnabled) { log.debug("hostname verification disabled"); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return true; } }; } final String tHostname = hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname; log.debug("configuring DefaultHostnameVerifier to expect hostname={}", tHostname); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return delegate.verify(tHostname, sslSession); } }; } HostnameVerifierProvider(final boolean hostnameVerificationEnabled,
                                  final HostnameVerifier delegate); }
HostnameVerifierProvider { public HostnameVerifier verifierFor(String hostname) { if (!hostnameVerificationEnabled) { log.debug("hostname verification disabled"); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return true; } }; } final String tHostname = hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname; log.debug("configuring DefaultHostnameVerifier to expect hostname={}", tHostname); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return delegate.verify(tHostname, sslSession); } }; } HostnameVerifierProvider(final boolean hostnameVerificationEnabled,
                                  final HostnameVerifier delegate); HostnameVerifier verifierFor(String hostname); }
HostnameVerifierProvider { public HostnameVerifier verifierFor(String hostname) { if (!hostnameVerificationEnabled) { log.debug("hostname verification disabled"); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return true; } }; } final String tHostname = hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname; log.debug("configuring DefaultHostnameVerifier to expect hostname={}", tHostname); return new HostnameVerifier() { @Override public boolean verify(final String str, final SSLSession sslSession) { return delegate.verify(tHostname, sslSession); } }; } HostnameVerifierProvider(final boolean hostnameVerificationEnabled,
                                  final HostnameVerifier delegate); HostnameVerifier verifierFor(String hostname);  }