From e7d7f685542ee3ec31b553a0fd258232922e311b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Wed, 29 Apr 2020 19:18:58 +0200 Subject: [PATCH] update to 4.1.49, remove all epoll for Linux build --- gradle.properties | 4 +-- netty-http-client/build.gradle | 2 +- netty-http-server/build.gradle | 4 +-- .../http/server/test/BindExceptionTest.java | 1 + .../http/server/test/http2/CleartextTest.java | 7 ++--- .../http/server/test/http2/EncryptedTest.java | 28 ++++++++++++------- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index e8b0384..6abee79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ group = org.xbib name = netty-http -version = 4.1.48.0 +version = 4.1.49.0 # netty -netty.version = 4.1.48.Final +netty.version = 4.1.49.Final tcnative.version = 2.0.29.Final tcnative-legacy-macosx.version = 2.0.26.Final diff --git a/netty-http-client/build.gradle b/netty-http-client/build.gradle index f899ce4..204406c 100644 --- a/netty-http-client/build.gradle +++ b/netty-http-client/build.gradle @@ -9,7 +9,7 @@ dependencies { //runtime project(':netty-http-kqueue') } else if (Os.isFamily(Os.FAMILY_UNIX)) { runtime "io.netty:netty-tcnative-boringssl-static:${project.property('tcnative.version')}" - runtime project(':netty-http-epoll') + //runtime project(':netty-http-epoll') } testCompile "org.conscrypt:conscrypt-openjdk-uber:${project.property('conscrypt.version')}" testCompile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}" diff --git a/netty-http-server/build.gradle b/netty-http-server/build.gradle index 0b99e18..f7237a1 100644 --- a/netty-http-server/build.gradle +++ b/netty-http-server/build.gradle @@ -8,8 +8,8 @@ dependencies { //runtime project(':netty-http-kqueue') } else if (Os.isFamily(Os.FAMILY_UNIX)) { testRuntime "io.netty:netty-tcnative-boringssl-static:${project.property('tcnative.version')}" - testRuntime project(':netty-http-epoll') + //testRuntime project(':netty-http-epoll') } testCompile project(":netty-http-client") - testRuntime project(":netty-http-bouncycastle") + testCompile project(":netty-http-bouncycastle") } diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/BindExceptionTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/BindExceptionTest.java index 1db792b..6f8693d 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/BindExceptionTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/BindExceptionTest.java @@ -23,6 +23,7 @@ class BindExceptionTest { Server server1 = Server.builder(domain).build(); Server server2 = Server.builder(domain).build(); try { + // ATTN: when using native libraries (epoll), the bind exception will be an internal error Assertions.assertThrows(BindException.class, () ->{ ChannelFuture channelFuture1 = server1.accept(); assertNotNull(channelFuture1); diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/CleartextTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/CleartextTest.java index c905713..f450855 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/CleartextTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/CleartextTest.java @@ -75,7 +75,7 @@ class CleartextTest { @Test void testPooledClearTextHttp2() throws Exception { - int loop = 1000; + int loop = 1024; HttpAddress httpAddress = HttpAddress.http2("localhost", 8008); Domain domain = Domain.builder(httpAddress) .singleEndpoint("/", (request, response) -> @@ -90,8 +90,7 @@ class CleartextTest { .addPoolNode(httpAddress) .setPoolNodeConnectionLimit(2) .build(); - AtomicInteger counter = new AtomicInteger(); - // a single instance of HTTP/2 response listener, always receives responses out-of-order + final AtomicInteger counter = new AtomicInteger(); final ResponseListener responseListener = resp -> { if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) { counter.incrementAndGet(); @@ -116,7 +115,7 @@ class CleartextTest { break; } } - transport.get(); + transport.get(60L, TimeUnit.SECONDS); } finally { server.shutdownGracefully(); client.shutdownGracefully(); diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java index eeb1d0f..b4d25bb 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java @@ -73,13 +73,14 @@ class EncryptedTest { void testPooledSecureHttp2() throws Exception { int loop = 1024; HttpAddress httpAddress = HttpAddress.secureHttp2("localhost", 8143); - Server server = Server.builder(Domain.builder(httpAddress) + Domain domain = Domain.builder(httpAddress) .setSelfCert() .singleEndpoint("/", (request, response) -> - response.withStatus(HttpResponseStatus.OK) - .withContentType("text/plain") - .write(request.getContent().retain())) - .build()) + response.withStatus(HttpResponseStatus.OK) + .withContentType("text/plain") + .write(request.getContent().retain())) + .build(); + Server server = Server.builder(domain) .build(); server.accept(); Client client = Client.builder() @@ -87,9 +88,15 @@ class EncryptedTest { .addPoolNode(httpAddress) .setPoolNodeConnectionLimit(2) .build(); - AtomicInteger counter = new AtomicInteger(); - // a single instance of HTTP/2 response listener, always receives responses out-of-order - final ResponseListener responseListener = resp -> counter.incrementAndGet(); + final AtomicInteger counter = new AtomicInteger(); + final ResponseListener responseListener = resp -> { + if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) { + counter.incrementAndGet(); + } else { + logger.log(Level.INFO, "response listener: headers = " + resp.getHeaders() + + " response body = " + resp.getBodyAsString(StandardCharsets.UTF_8)); + } + }; try { // single transport, single thread Transport transport = client.newTransport(); @@ -106,11 +113,12 @@ class EncryptedTest { break; } } - transport.get(60, TimeUnit.SECONDS); + transport.get(60L, TimeUnit.SECONDS); } finally { - client.shutdownGracefully(); server.shutdownGracefully(); + client.shutdownGracefully(); } + logger.log(Level.INFO, "expecting=" + loop + " counter=" + counter.get()); assertEquals(loop, counter.get()); }