diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java index b550f9d17..5df9ae02d 100644 --- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java +++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java @@ -70,7 +70,7 @@ public class AsyncClientHttp2FullDuplexExchange { client.start(); - final URI requestUri = new URI("http://http2bin.org/post"); + final URI requestUri = new URI("http://nghttp2.org/httpbin/post"); final BasicRequestProducer requestProducer = new BasicRequestProducer( "POST", requestUri, new BasicAsyncEntityProducer("stuff", ContentType.TEXT_PLAIN)); final BasicResponseConsumer responseConsumer = new BasicResponseConsumer<>( diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java index e7e754aa2..16d8e28a3 100644 --- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java +++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java @@ -62,11 +62,11 @@ public class AsyncClientHttp2Multiplexing { client.start(); - final HttpHost target = new HttpHost("http2bin.org"); + final HttpHost target = new HttpHost("nghttp2.org"); final Future leaseFuture = client.lease(target, null); final AsyncClientEndpoint endpoint = leaseFuture.get(30, TimeUnit.SECONDS); try { - final String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"}; + final String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"}; final CountDownLatch latch = new CountDownLatch(requestUris.length); for (final String requestUri: requestUris) { diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java index e7d7b4284..ecf8d2bd7 100644 --- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java +++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java @@ -114,8 +114,8 @@ public class AsyncClientHttp2ServerPush { }); - final HttpHost target = new HttpHost("http2bin.org"); - final String requestURI = "/"; + final HttpHost target = new HttpHost("nghttp2.org"); + final String requestURI = "/httpbin/"; final Future future = client.execute( AsyncRequestBuilder.get(target, requestURI).build(), new AbstractCharResponseConsumer() { diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java index 77bb55c35..b4aa36d5a 100644 --- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java +++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java @@ -26,11 +26,8 @@ */ package org.apache.hc.client5.http.examples; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; import java.util.concurrent.Future; -import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import org.apache.hc.client5.http.async.methods.SimpleHttpRequest; @@ -49,7 +46,6 @@ import org.apache.hc.core5.http.nio.ssl.TlsStrategy; import org.apache.hc.core5.http2.HttpVersionPolicy; import org.apache.hc.core5.io.ShutdownType; import org.apache.hc.core5.ssl.SSLContexts; -import org.apache.hc.core5.ssl.TrustStrategy; /** * This example demonstrates how to avoid the illegal reflective access operation warning @@ -58,22 +54,8 @@ import org.apache.hc.core5.ssl.TrustStrategy; public class AsyncClientTlsAlpn { public final static void main(final String[] args) throws Exception { - // Trust standard CA and those trusted by our custom strategy - final SSLContext sslcontext = SSLContexts.custom() - .loadTrustMaterial(new TrustStrategy() { - - @Override - public boolean isTrusted( - final X509Certificate[] chain, - final String authType) throws CertificateException { - final X509Certificate cert = chain[0]; - return "CN=http2bin.org".equalsIgnoreCase(cert.getSubjectDN().getName()); - } - - }) - .build(); final TlsStrategy tlsStrategy = new H2TlsStrategy( - sslcontext, + SSLContexts.createSystemDefault(), H2TlsStrategy.getDefaultHostnameVerifier()) { // IMPORTANT uncomment the following method when running Java 9 or older @@ -94,8 +76,8 @@ public class AsyncClientTlsAlpn { client.start(); - final HttpHost target = new HttpHost("http2bin.org", 443, "https"); - final String requestUri = "/"; + final HttpHost target = new HttpHost("nghttp2.org", 443, "https"); + final String requestUri = "/httpbin/"; final HttpClientContext clientContext = HttpClientContext.create(); final SimpleHttpRequest request = SimpleHttpRequest.get(target, requestUri);