On Mon, Jan 18, 2021 at 1:07 PM <r...@apache.org> wrote: > This is an automated email from the ASF dual-hosted git repository. > > remm pushed a commit to branch master > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > The following commit(s) were added to refs/heads/master by this push: > new 16e3ef4 Add UDS test case > new bda7cbb Merge branch 'master' of g...@github.com: > apache/tomcat.git > 16e3ef4 is described below > > commit 16e3ef43f2fd3aa4ac9dcf14a8e985ef0754022c > Author: remm <r...@apache.org> > AuthorDate: Mon Jan 18 12:06:22 2021 +0100 > > Add UDS test case > > And a Java 16 compat flag. > --- > java/org/apache/tomcat/util/compat/JreCompat.java | 9 +++++++ > .../apache/tomcat/util/net/TestXxxEndpoint.java | 29 > ++++++++++++++++++++++ > 2 files changed, 38 insertions(+) > > diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java > b/java/org/apache/tomcat/util/compat/JreCompat.java > index b8b3b48..d58c1a0 100644 > --- a/java/org/apache/tomcat/util/compat/JreCompat.java > +++ b/java/org/apache/tomcat/util/compat/JreCompat.java > @@ -45,6 +45,7 @@ public class JreCompat { > > private static final JreCompat instance; > private static final boolean graalAvailable; > + private static final boolean jre16Available; > private static final boolean jre11Available; > private static final boolean jre9Available; > private static final StringManager sm = > StringManager.getManager(JreCompat.class); > @@ -69,12 +70,15 @@ public class JreCompat { > if (Jre16Compat.isSupported()) { > instance = new Jre16Compat(); > jre9Available = true; > + jre16Available = true; > } else if (Jre9Compat.isSupported()) { > instance = new Jre9Compat(); > jre9Available = true; > + jre16Available = false; > } else { > instance = new JreCompat(); > jre9Available = false; > + jre16Available = false; > } > jre11Available = instance.jarFileRuntimeMajorVersion() >= 11; > > @@ -116,6 +120,11 @@ public class JreCompat { > } > > > + public static boolean isJre16Available() { > + return jre16Available; > + } > + > + > // Java 8 implementation of Java 9 methods > > /** > diff --git a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java > b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java > index 2db184f..12a4015 100644 > --- a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java > +++ b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java > @@ -19,8 +19,12 @@ package org.apache.tomcat.util.net; > import java.io.File; > import java.net.InetAddress; > import java.net.ServerSocket; > +import java.net.SocketAddress; > +import java.nio.ByteBuffer; > +import java.nio.channels.SocketChannel; > > import org.junit.Assert; > +import org.junit.Assume; > import org.junit.Test; > > import org.apache.catalina.connector.Connector; > @@ -29,6 +33,7 @@ import org.apache.catalina.startup.TomcatBaseTest; > import org.apache.tomcat.jni.Error; > import org.apache.tomcat.jni.Library; > import org.apache.tomcat.jni.Pool; > +import org.apache.tomcat.util.compat.JreCompat; > > /** > * Test case for the Endpoint implementations. The testing framework will > ensure > @@ -206,4 +211,28 @@ public class TestXxxEndpoint extends TomcatBaseTest { > Assert.assertNull(e); > tomcat.getConnector().start(); > } > + > + @Test > + public void testUnixDomainSocket() throws Exception { > + >
maybe move Assume.assumeTrue("JDK 16 is required", JreCompat.isJre16Available()); here ? Before starting Tomcat instance > + Tomcat tomcat = getTomcatInstance(); > + Connector c = tomcat.getConnector(); > + Assume.assumeTrue("SSL renegotiation has to be supported for this > test", > Is this copy/paste error ? The SSL renegotiation message seems unrelated. > + c.getProtocolHandlerClassName().contains("Nio") > + && JreCompat.isJre16Available()); > + > + final String unixDomainSocketPath = "/tmp/testUnixDomainSocket"; > + Assert.assertTrue(c.setProperty("unixDomainSocketPath", > unixDomainSocketPath)); > + tomcat.start(); > + > + SocketAddress sa = > JreCompat.getInstance().getUnixDomainSocketAddress(unixDomainSocketPath); > + ByteBuffer response = ByteBuffer.allocate(1024); > + try (SocketChannel socket = > JreCompat.getInstance().openUnixDomainSocketChannel()) { > + socket.connect(sa); > + socket.write(ByteBuffer.wrap("OPTIONS * > HTTP/1.0\r\n\r\n".getBytes())); > Is HTTP/1.0 intentional ? Because the assertion below checks for 1.1 > + socket.read(response); > + } > + > + Assert.assertTrue((new String(response.array(), 0, > response.position()).startsWith("HTTP/1.1 200"))); > + } > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >