update to 4.1.49, remove all epoll for Linux build

This commit is contained in:
Jörg Prante 2020-04-29 19:18:58 +02:00
parent ced37bd8d1
commit e7d7f68554
6 changed files with 27 additions and 19 deletions

View file

@ -1,9 +1,9 @@
group = org.xbib group = org.xbib
name = netty-http name = netty-http
version = 4.1.48.0 version = 4.1.49.0
# netty # netty
netty.version = 4.1.48.Final netty.version = 4.1.49.Final
tcnative.version = 2.0.29.Final tcnative.version = 2.0.29.Final
tcnative-legacy-macosx.version = 2.0.26.Final tcnative-legacy-macosx.version = 2.0.26.Final

View file

@ -9,7 +9,7 @@ dependencies {
//runtime project(':netty-http-kqueue') //runtime project(':netty-http-kqueue')
} else if (Os.isFamily(Os.FAMILY_UNIX)) { } else if (Os.isFamily(Os.FAMILY_UNIX)) {
runtime "io.netty:netty-tcnative-boringssl-static:${project.property('tcnative.version')}" 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 "org.conscrypt:conscrypt-openjdk-uber:${project.property('conscrypt.version')}"
testCompile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}" testCompile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}"

View file

@ -8,8 +8,8 @@ dependencies {
//runtime project(':netty-http-kqueue') //runtime project(':netty-http-kqueue')
} else if (Os.isFamily(Os.FAMILY_UNIX)) { } else if (Os.isFamily(Os.FAMILY_UNIX)) {
testRuntime "io.netty:netty-tcnative-boringssl-static:${project.property('tcnative.version')}" 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") testCompile project(":netty-http-client")
testRuntime project(":netty-http-bouncycastle") testCompile project(":netty-http-bouncycastle")
} }

View file

@ -23,6 +23,7 @@ class BindExceptionTest {
Server server1 = Server.builder(domain).build(); Server server1 = Server.builder(domain).build();
Server server2 = Server.builder(domain).build(); Server server2 = Server.builder(domain).build();
try { try {
// ATTN: when using native libraries (epoll), the bind exception will be an internal error
Assertions.assertThrows(BindException.class, () ->{ Assertions.assertThrows(BindException.class, () ->{
ChannelFuture channelFuture1 = server1.accept(); ChannelFuture channelFuture1 = server1.accept();
assertNotNull(channelFuture1); assertNotNull(channelFuture1);

View file

@ -75,7 +75,7 @@ class CleartextTest {
@Test @Test
void testPooledClearTextHttp2() throws Exception { void testPooledClearTextHttp2() throws Exception {
int loop = 1000; int loop = 1024;
HttpAddress httpAddress = HttpAddress.http2("localhost", 8008); HttpAddress httpAddress = HttpAddress.http2("localhost", 8008);
Domain domain = Domain.builder(httpAddress) Domain domain = Domain.builder(httpAddress)
.singleEndpoint("/", (request, response) -> .singleEndpoint("/", (request, response) ->
@ -90,8 +90,7 @@ class CleartextTest {
.addPoolNode(httpAddress) .addPoolNode(httpAddress)
.setPoolNodeConnectionLimit(2) .setPoolNodeConnectionLimit(2)
.build(); .build();
AtomicInteger counter = new AtomicInteger(); final AtomicInteger counter = new AtomicInteger();
// a single instance of HTTP/2 response listener, always receives responses out-of-order
final ResponseListener<HttpResponse> responseListener = resp -> { final ResponseListener<HttpResponse> responseListener = resp -> {
if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) { if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) {
counter.incrementAndGet(); counter.incrementAndGet();
@ -116,7 +115,7 @@ class CleartextTest {
break; break;
} }
} }
transport.get(); transport.get(60L, TimeUnit.SECONDS);
} finally { } finally {
server.shutdownGracefully(); server.shutdownGracefully();
client.shutdownGracefully(); client.shutdownGracefully();

View file

@ -73,13 +73,14 @@ class EncryptedTest {
void testPooledSecureHttp2() throws Exception { void testPooledSecureHttp2() throws Exception {
int loop = 1024; int loop = 1024;
HttpAddress httpAddress = HttpAddress.secureHttp2("localhost", 8143); HttpAddress httpAddress = HttpAddress.secureHttp2("localhost", 8143);
Server server = Server.builder(Domain.builder(httpAddress) Domain domain = Domain.builder(httpAddress)
.setSelfCert() .setSelfCert()
.singleEndpoint("/", (request, response) -> .singleEndpoint("/", (request, response) ->
response.withStatus(HttpResponseStatus.OK) response.withStatus(HttpResponseStatus.OK)
.withContentType("text/plain") .withContentType("text/plain")
.write(request.getContent().retain())) .write(request.getContent().retain()))
.build()) .build();
Server server = Server.builder(domain)
.build(); .build();
server.accept(); server.accept();
Client client = Client.builder() Client client = Client.builder()
@ -87,9 +88,15 @@ class EncryptedTest {
.addPoolNode(httpAddress) .addPoolNode(httpAddress)
.setPoolNodeConnectionLimit(2) .setPoolNodeConnectionLimit(2)
.build(); .build();
AtomicInteger counter = new AtomicInteger(); final AtomicInteger counter = new AtomicInteger();
// a single instance of HTTP/2 response listener, always receives responses out-of-order final ResponseListener<HttpResponse> responseListener = resp -> {
final ResponseListener<HttpResponse> responseListener = resp -> counter.incrementAndGet(); 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 { try {
// single transport, single thread // single transport, single thread
Transport transport = client.newTransport(); Transport transport = client.newTransport();
@ -106,11 +113,12 @@ class EncryptedTest {
break; break;
} }
} }
transport.get(60, TimeUnit.SECONDS); transport.get(60L, TimeUnit.SECONDS);
} finally { } finally {
client.shutdownGracefully();
server.shutdownGracefully(); server.shutdownGracefully();
client.shutdownGracefully();
} }
logger.log(Level.INFO, "expecting=" + loop + " counter=" + counter.get());
assertEquals(loop, counter.get()); assertEquals(loop, counter.get());
} }