You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2019/02/13 17:23:35 UTC

[httpcomponents-core] branch HTTPCORE-572 updated: [HTTPCORE-572] Move examples to the src/test folders for each module.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch HTTPCORE-572
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/HTTPCORE-572 by this push:
     new 499c549  [HTTPCORE-572] Move examples to the src/test folders for each module.
499c549 is described below

commit 499c549c841bd5eca89997ad809e7d832903d89a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Feb 13 12:23:34 2019 -0500

    [HTTPCORE-572] Move examples to the src/test folders for each module.
---
 .../Http2ConscriptRequestExecutionExample.java     | 12 ++++++------
 .../http2}/examples/Http2FileServerExample.java    | 22 +++++++++++-----------
 .../examples/Http2FullDuplexClientExample.java     | 14 +++++++-------
 .../examples/Http2FullDuplexServerExample.java     | 12 ++++++------
 .../examples/Http2MultiStreamExecutionExample.java | 20 ++++++++++----------
 .../examples/Http2RequestExecutionExample.java     | 14 +++++++-------
 .../Http2TlsAlpnRequestExecutionExample.java       | 12 ++++++------
 .../examples/ReactiveFullDuplexClientExample.java  |  2 +-
 .../examples/ReactiveFullDuplexServerExample.java  |  8 ++++----
 .../http/examples/AsyncFileServerExample.java      |  2 +-
 .../examples/AsyncFullDuplexClientExample.java     |  0
 .../examples/AsyncFullDuplexServerExample.java     |  0
 .../AsyncPipelinedRequestExecutionExample.java     |  0
 .../examples/AsyncRequestExecutionExample.java     |  0
 .../http/examples/AsyncReverseProxyExample.java    |  4 ++--
 .../http/examples/AsyncServerFilterExample.java    |  0
 .../http/examples/ClassicFileServerExample.java    |  0
 .../http/examples/ClassicGetExecutionExample.java  |  0
 .../http/examples/ClassicPostExecutionExample.java |  0
 .../ClassicPostWithTrailersExecutionExample.java   |  0
 .../http/examples/ClassicReverseProxyExample.java  |  0
 .../http/examples/ClassicServerFilterExample.java  |  0
 .../hc/core5/http/examples/PrintVersionInfo.java   |  0
 pom.xml                                            | 10 +++++++++-
 24 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2ConscriptRequestExecutionExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2ConscriptRequestExecutionExample.java
similarity index 94%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2ConscriptRequestExecutionExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2ConscriptRequestExecutionExample.java
index 82585c8..45e051e 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2ConscriptRequestExecutionExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2ConscriptRequestExecutionExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -62,7 +62,7 @@ public class Http2ConscriptRequestExecutionExample {
     public final static void main(final String[] args) throws Exception {
 
         // Create and start requester
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(false)
                 .build();
 
@@ -116,8 +116,8 @@ public class Http2ConscriptRequestExecutionExample {
         });
         requester.start();
 
-        HttpHost target = new HttpHost("https", "nghttp2.org", 443);
-        String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
+        final HttpHost target = new HttpHost("https", "nghttp2.org", 443);
+        final String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
 
         final CountDownLatch latch = new CountDownLatch(requestUris.length);
         for (final String requestUri: requestUris) {
@@ -131,8 +131,8 @@ public class Http2ConscriptRequestExecutionExample {
                         @Override
                         public void completed(final Message<HttpResponse, String> message) {
                             clientEndpoint.releaseAndReuse();
-                            HttpResponse response = message.getHead();
-                            String body = message.getBody();
+                            final HttpResponse response = message.getHead();
+                            final String body = message.getBody();
                             System.out.println(requestUri + "->" + response.getCode() + " " + response.getVersion());
                             System.out.println(body);
                             latch.countDown();
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FileServerExample.java
similarity index 92%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FileServerExample.java
index bc60c38..7d1929e 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FileServerExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.io.File;
 import java.io.IOException;
@@ -69,7 +69,7 @@ import org.apache.hc.core5.util.TimeValue;
  */
 public class Http2FileServerExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         if (args.length < 1) {
             System.err.println("Please specify document root directory");
             System.exit(1);
@@ -81,7 +81,7 @@ public class Http2FileServerExample {
             port = Integer.parseInt(args[1]);
         }
 
-        IOReactorConfig config = IOReactorConfig.custom()
+        final IOReactorConfig config = IOReactorConfig.custom()
                 .setSoTimeout(15, TimeUnit.SECONDS)
                 .setTcpNoDelay(true)
                 .build();
@@ -137,14 +137,14 @@ public class Http2FileServerExample {
                             final Message<HttpRequest, Void> message,
                             final ResponseTrigger responseTrigger,
                             final HttpContext context) throws HttpException, IOException {
-                        HttpRequest request = message.getHead();
-                        URI requestUri;
+                        final HttpRequest request = message.getHead();
+                        final URI requestUri;
                         try {
                             requestUri = request.getUri();
-                        } catch (URISyntaxException ex) {
+                        } catch (final URISyntaxException ex) {
                             throw new ProtocolException(ex.getMessage(), ex);
                         }
-                        String path = requestUri.getPath();
+                        final String path = requestUri.getPath();
                         final File file = new File(docRoot, path);
                         if (!file.exists()) {
 
@@ -177,8 +177,8 @@ public class Http2FileServerExample {
                                 contentType = ContentType.DEFAULT_BINARY;
                             }
 
-                            HttpCoreContext coreContext = HttpCoreContext.adapt(context);
-                            EndpointDetails endpoint = coreContext.getEndpointDetails();
+                            final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
+                            final EndpointDetails endpoint = coreContext.getEndpointDetails();
                             System.out.println(endpoint + ": serving file " + file.getPath());
                             responseTrigger.submitResponse(new BasicResponseProducer(
                                     HttpStatus.SC_OK, new FileEntityProducer(file, contentType)), context);
@@ -197,8 +197,8 @@ public class Http2FileServerExample {
         });
 
         server.start();
-        Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
-        ListenerEndpoint listenerEndpoint = future.get();
+        final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+        final ListenerEndpoint listenerEndpoint = future.get();
         System.out.print("Listening on " + listenerEndpoint.getAddress());
         server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
     }
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexClientExample.java
similarity index 94%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexClientExample.java
index 571f8b2..1978daa 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexClientExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.io.IOException;
 import java.net.URI;
@@ -64,14 +64,14 @@ import org.apache.hc.core5.util.Timeout;
  */
 public class Http2FullDuplexClientExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
 
-        IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
+        final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
                 .setSoTimeout(5, TimeUnit.SECONDS)
                 .build();
 
         // Create and start requester
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(false)
                 .setMaxConcurrentStreams(100)
                 .build();
@@ -150,7 +150,7 @@ public class Http2FullDuplexClientExample {
             }
 
             @Override
-            public void produceRequest(final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
+            public void produceRequest(final RequestChannel channel, final HttpContext httpContext) throws HttpException, IOException {
                 requestProducer.sendRequest(channel, httpContext);
             }
 
@@ -165,12 +165,12 @@ public class Http2FullDuplexClientExample {
             }
 
             @Override
-            public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
+            public void consumeInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
             }
 
             @Override
-            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
+            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
                 responseConsumer.consumeResponse(response, entityDetails, httpContext, null);
             }
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexServerExample.java
similarity index 96%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexServerExample.java
index 99d88fe..55e34dd 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2FullDuplexServerExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -64,18 +64,18 @@ import org.apache.hc.core5.util.TimeValue;
  */
 public class Http2FullDuplexServerExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         int port = 8080;
         if (args.length >= 1) {
             port = Integer.parseInt(args[0]);
         }
 
-        IOReactorConfig config = IOReactorConfig.custom()
+        final IOReactorConfig config = IOReactorConfig.custom()
                 .setSoTimeout(15, TimeUnit.SECONDS)
                 .setTcpNoDelay(true)
                 .build();
 
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(true)
                 .setMaxConcurrentStreams(100)
                 .build();
@@ -235,8 +235,8 @@ public class Http2FullDuplexServerExample {
         });
 
         server.start();
-        Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
-        ListenerEndpoint listenerEndpoint = future.get();
+        final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+        final ListenerEndpoint listenerEndpoint = future.get();
         System.out.print("Listening on " + listenerEndpoint.getAddress());
         server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
     }
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2MultiStreamExecutionExample.java
similarity index 89%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2MultiStreamExecutionExample.java
index 2f08832..bebe2df 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2MultiStreamExecutionExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -56,14 +56,14 @@ import org.apache.hc.core5.util.Timeout;
  */
 public class Http2MultiStreamExecutionExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
 
         // Create and start requester
-        IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
+        final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
                 .setSoTimeout(5, TimeUnit.SECONDS)
                 .build();
 
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(false)
                 .setMaxConcurrentStreams(100)
                 .build();
@@ -115,11 +115,11 @@ public class Http2MultiStreamExecutionExample {
         });
         requester.start();
 
-        HttpHost target = new HttpHost("nghttp2.org");
-        String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
+        final HttpHost target = new HttpHost("nghttp2.org");
+        final String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
 
-        Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
-        AsyncClientEndpoint clientEndpoint = future.get();
+        final Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
+        final AsyncClientEndpoint clientEndpoint = future.get();
 
         final CountDownLatch latch = new CountDownLatch(requestUris.length);
         for (final String requestUri: requestUris) {
@@ -131,8 +131,8 @@ public class Http2MultiStreamExecutionExample {
                         @Override
                         public void completed(final Message<HttpResponse, String> message) {
                             latch.countDown();
-                            HttpResponse response = message.getHead();
-                            String body = message.getBody();
+                            final HttpResponse response = message.getHead();
+                            final String body = message.getBody();
                             System.out.println(requestUri + "->" + response.getCode());
                             System.out.println(body);
                         }
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2RequestExecutionExample.java
similarity index 92%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2RequestExecutionExample.java
index 1cbbf0d..2ecc322 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2RequestExecutionExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -54,10 +54,10 @@ import org.apache.hc.core5.util.Timeout;
  */
 public class Http2RequestExecutionExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
 
         // Create and start requester
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(false)
                 .build();
 
@@ -107,8 +107,8 @@ public class Http2RequestExecutionExample {
         });
         requester.start();
 
-        HttpHost target = new HttpHost("nghttp2.org");
-        String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
+        final HttpHost target = new HttpHost("nghttp2.org");
+        final String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
 
         final CountDownLatch latch = new CountDownLatch(requestUris.length);
         for (final String requestUri: requestUris) {
@@ -122,8 +122,8 @@ public class Http2RequestExecutionExample {
                         @Override
                         public void completed(final Message<HttpResponse, String> message) {
                             clientEndpoint.releaseAndReuse();
-                            HttpResponse response = message.getHead();
-                            String body = message.getBody();
+                            final HttpResponse response = message.getHead();
+                            final String body = message.getBody();
                             System.out.println(requestUri + "->" + response.getCode());
                             System.out.println(body);
                             latch.countDown();
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2TlsAlpnRequestExecutionExample.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2TlsAlpnRequestExecutionExample.java
similarity index 94%
rename from httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2TlsAlpnRequestExecutionExample.java
rename to httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2TlsAlpnRequestExecutionExample.java
index fa98e0a..231ba2a 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2TlsAlpnRequestExecutionExample.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/Http2TlsAlpnRequestExecutionExample.java
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.core5.http.examples;
+package org.apache.hc.core5.http2.examples;
 
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -65,7 +65,7 @@ public class Http2TlsAlpnRequestExecutionExample {
 
     public final static void main(final String[] args) throws Exception {
         // Create and start requester
-        H2Config h2Config = H2Config.custom()
+        final H2Config h2Config = H2Config.custom()
                 .setPushEnabled(false)
                 .build();
 
@@ -127,8 +127,8 @@ public class Http2TlsAlpnRequestExecutionExample {
         });
         requester.start();
 
-        HttpHost target = new HttpHost("https", "nghttp2.org", 443);
-        String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
+        final HttpHost target = new HttpHost("https", "nghttp2.org", 443);
+        final String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"};
 
         final CountDownLatch latch = new CountDownLatch(requestUris.length);
         for (final String requestUri: requestUris) {
@@ -142,8 +142,8 @@ public class Http2TlsAlpnRequestExecutionExample {
                         @Override
                         public void completed(final Message<HttpResponse, String> message) {
                             clientEndpoint.releaseAndReuse();
-                            HttpResponse response = message.getHead();
-                            String body = message.getBody();
+                            final HttpResponse response = message.getHead();
+                            final String body = message.getBody();
                             System.out.println(requestUri + "->" + response.getCode() + " " + response.getVersion());
                             System.out.println(body);
                             latch.countDown();
diff --git a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java b/httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
similarity index 99%
rename from httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
rename to httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
index 057bb6c..6db9791 100644
--- a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
+++ b/httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
@@ -67,7 +67,7 @@ import io.reactivex.functions.Function;
  */
 public class ReactiveFullDuplexClientExample {
 
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         String endpoint = "http://localhost:8080/echo";
         if (args.length >= 1) {
             endpoint = args[0];
diff --git a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java b/httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java
similarity index 95%
rename from httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java
rename to httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java
index 9e37886..08b4d93 100644
--- a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java
+++ b/httpcore5-reactive/src/test/java/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexServerExample.java
@@ -64,13 +64,13 @@ import org.reactivestreams.Publisher;
  * with {@link ReactiveFullDuplexClientExample}; it can also be invoked interactively using telnet.
  */
 public class ReactiveFullDuplexServerExample {
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         int port = 8080;
         if (args.length >= 1) {
             port = Integer.parseInt(args[0]);
         }
 
-        IOReactorConfig config = IOReactorConfig.custom()
+        final IOReactorConfig config = IOReactorConfig.custom()
             .setSoTimeout(15, TimeUnit.SECONDS)
             .setTcpNoDelay(true)
             .build();
@@ -139,8 +139,8 @@ public class ReactiveFullDuplexServerExample {
         });
 
         server.start();
-        Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
-        ListenerEndpoint listenerEndpoint = future.get();
+        final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+        final ListenerEndpoint listenerEndpoint = future.get();
         System.out.print("Listening on " + listenerEndpoint.getAddress());
         server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
     }
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
similarity index 99%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
index b41f883..87775d7 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
@@ -100,7 +100,7 @@ public class AsyncFileServerExample {
                             final ResponseTrigger responseTrigger,
                             final HttpContext context) throws HttpException, IOException {
                         final HttpRequest request = message.getHead();
-                        URI requestUri;
+                        final URI requestUri;
                         try {
                             requestUri = request.getUri();
                         } catch (final URISyntaxException ex) {
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
similarity index 99%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index 4f50bed..aded0f3 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -325,7 +325,7 @@ public class AsyncReverseProxyExample {
 
                     try {
                         responseChannel.sendResponse(outgoingResponse, exEntityDetails, httpContext);
-                    } catch (HttpException | IOException ignore) {
+                    } catch (final HttpException | IOException ignore) {
                         // ignore
                     }
                 }
@@ -667,7 +667,7 @@ public class AsyncReverseProxyExample {
                     try {
                         final EntityDetails entityDetails = new BasicEntityDetails(contentLen, ContentType.TEXT_PLAIN);
                         exchangeState.responseMessageChannel.sendResponse(outgoingResponse, entityDetails, null);
-                    } catch (HttpException | IOException ignore) {
+                    } catch (final HttpException | IOException ignore) {
                         // ignore
                     }
                 } else {
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/PrintVersionInfo.java
similarity index 100%
rename from httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java
rename to httpcore5/src/test/java/org/apache/hc/core5/http/examples/PrintVersionInfo.java
diff --git a/pom.xml b/pom.xml
index af6a451..c03af35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -185,7 +185,15 @@
               <outputDirectory>${basedir}/target/site/examples</outputDirectory>
               <resources>
                 <resource>
-                  <directory>src/examples</directory>
+                  <directory>src/test/java/org/apache/hc/core5/http/examples</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  <directory>src/test/java/org/apache/hc/core5/http2/examples</directory>
+                  <filtering>false</filtering>
+                </resource>
+                <resource>
+                  <directory>src/test/java/org/apache/hc/core5/reactive/examples</directory>
                   <filtering>false</filtering>
                 </resource>
               </resources>