diff --git a/jetty-bom/pom.xml b/jetty-bom/pom.xml index 2ece3477aaf..31df62c78dc 100644 --- a/jetty-bom/pom.xml +++ b/jetty-bom/pom.xml @@ -296,7 +296,17 @@ org.eclipse.jetty - jetty-unixsocket + jetty-unixsocket-common + 10.0.0-SNAPSHOT + + + org.eclipse.jetty + jetty-unixsocket-client + 10.0.0-SNAPSHOT + + + org.eclipse.jetty + jetty-unixsocket-server 10.0.0-SNAPSHOT diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml index c3dbd2104cd..7d3ebe1126b 100644 --- a/jetty-home/pom.xml +++ b/jetty-home/pom.xml @@ -617,7 +617,7 @@ org.eclipse.jetty - jetty-unixsocket + jetty-unixsocket-server ${project.version} diff --git a/jetty-unixsocket/jetty-unixsocket-client/pom.xml b/jetty-unixsocket/jetty-unixsocket-client/pom.xml new file mode 100644 index 00000000000..7caa4da0526 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-client/pom.xml @@ -0,0 +1,44 @@ + + + + jetty-unixsocket + org.eclipse.jetty + 10.0.0-SNAPSHOT + + + 4.0.0 + jetty-unixsocket-client + Jetty :: UnixSocket :: Client + + + ${project.groupId}.unixsocket.client + + + + + org.eclipse.jetty + jetty-unixsocket-common + ${project.version} + + + org.eclipse.jetty + jetty-client + ${project.version} + + + + org.eclipse.jetty + jetty-unixsocket-server + ${project.version} + test + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + + + diff --git a/jetty-unixsocket/jetty-unixsocket-client/src/main/java/module-info.java b/jetty-unixsocket/jetty-unixsocket-client/src/main/java/module-info.java new file mode 100644 index 00000000000..c5f1f5c93dd --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-client/src/main/java/module-info.java @@ -0,0 +1,29 @@ +// +// ======================================================================== +// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +module org.eclipse.jetty.unixsocket.client +{ + exports org.eclipse.jetty.unixsocket.client; + + requires jnr.enxio; + requires jnr.unixsocket; + requires org.eclipse.jetty.client; + requires org.eclipse.jetty.io; + requires org.eclipse.jetty.util; + requires org.eclipse.jetty.unixsocket.common; +} diff --git a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java b/jetty-unixsocket/jetty-unixsocket-client/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java similarity index 99% rename from jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java rename to jetty-unixsocket/jetty-unixsocket-client/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java index 36ea14e3bae..4f215917a12 100644 --- a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java +++ b/jetty-unixsocket/jetty-unixsocket-client/src/main/java/org/eclipse/jetty/unixsocket/client/HttpClientTransportOverUnixSockets.java @@ -45,7 +45,7 @@ import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.ManagedSelector; import org.eclipse.jetty.io.SelectorManager; -import org.eclipse.jetty.unixsocket.UnixSocketEndPoint; +import org.eclipse.jetty.unixsocket.common.UnixSocketEndPoint; import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java b/jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java similarity index 99% rename from jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java rename to jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java index 66ae618df6d..58a04f8b91a 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java +++ b/jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java @@ -24,12 +24,10 @@ import java.io.PrintWriter; import java.nio.CharBuffer; import java.nio.channels.Channels; import java.nio.charset.StandardCharsets; -import java.util.Date; - -import org.eclipse.jetty.toolchain.test.IO; import jnr.unixsocket.UnixSocketAddress; import jnr.unixsocket.UnixSocketChannel; +import org.eclipse.jetty.toolchain.test.IO; public class UnixSocketClient { diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java b/jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java similarity index 87% rename from jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java rename to jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java index b7b8dddf8c9..3437949f76d 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java +++ b/jetty-unixsocket/jetty-unixsocket-client/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketTest.java @@ -36,8 +36,8 @@ import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; -import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -49,8 +49,10 @@ import org.junit.jupiter.api.condition.EnabledOnOs; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.condition.OS.LINUX; import static org.junit.jupiter.api.condition.OS.MAC; @@ -69,12 +71,19 @@ public class UnixSocketTest server = null; httpClient = null; String unixSocketTmp = System.getProperty("unix.socket.tmp"); + Path unixSocket; if (StringUtil.isNotBlank(unixSocketTmp)) - sockFile = Files.createTempFile(Paths.get(unixSocketTmp), "unix", ".sock"); + unixSocket = Files.createTempFile(Paths.get(unixSocketTmp), "unix", ".sock"); else - sockFile = Files.createTempFile("unix", ".sock"); + unixSocket = Files.createTempFile("unix", ".sock"); + if (unixSocket.toAbsolutePath().toString().length() > UnixSocketConnector.MAX_UNIX_SOCKET_PATH_LENGTH) + { + Path tmp = Paths.get("/tmp"); + assumeTrue(Files.exists(tmp) && Files.isDirectory(tmp)); + unixSocket = Files.createTempFile(tmp, "unix", ".sock"); + } + sockFile = unixSocket; assertTrue(Files.deleteIfExists(sockFile), "temp sock file cannot be deleted"); - } @AfterEach @@ -84,8 +93,8 @@ public class UnixSocketTest httpClient.stop(); if (server != null) server.stop(); - // Force delete, this will fail if UnixSocket was not closed properly in the implementation - FS.delete(sockFile); + if (sockFile != null) + assertFalse(Files.exists(sockFile)); } @Test diff --git a/jetty-unixsocket/jetty-unixsocket-client/src/test/resources/jetty-logging.properties b/jetty-unixsocket/jetty-unixsocket-client/src/test/resources/jetty-logging.properties new file mode 100644 index 00000000000..f6dad82a697 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-client/src/test/resources/jetty-logging.properties @@ -0,0 +1,3 @@ +org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog +#org.eclipse.jetty.LEVEL=DEBUG +#org.eclipse.jetty.unixsocket.LEVEL=DEBUG diff --git a/jetty-unixsocket/jetty-unixsocket-common/pom.xml b/jetty-unixsocket/jetty-unixsocket-common/pom.xml new file mode 100644 index 00000000000..5b62ea25190 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-common/pom.xml @@ -0,0 +1,36 @@ + + + + org.eclipse.jetty + jetty-unixsocket + 10.0.0-SNAPSHOT + + + 4.0.0 + jetty-unixsocket-common + Jetty :: UnixSocket :: Common + + + ${project.groupId}.unixsocket.common + + + + + org.eclipse.jetty + jetty-io + ${project.version} + + + org.eclipse.jetty + jetty-util + ${project.version} + + + com.github.jnr + jnr-unixsocket + + + + diff --git a/jetty-unixsocket/jetty-unixsocket-common/src/main/java/module-info.java b/jetty-unixsocket/jetty-unixsocket-common/src/main/java/module-info.java new file mode 100644 index 00000000000..e6b1978986c --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-common/src/main/java/module-info.java @@ -0,0 +1,26 @@ +// +// ======================================================================== +// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +module org.eclipse.jetty.unixsocket.common +{ + exports org.eclipse.jetty.unixsocket.common; + + requires jnr.unixsocket; + requires org.eclipse.jetty.io; + requires org.eclipse.jetty.util; +} diff --git a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketEndPoint.java b/jetty-unixsocket/jetty-unixsocket-common/src/main/java/org/eclipse/jetty/unixsocket/common/UnixSocketEndPoint.java similarity index 97% rename from jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketEndPoint.java rename to jetty-unixsocket/jetty-unixsocket-common/src/main/java/org/eclipse/jetty/unixsocket/common/UnixSocketEndPoint.java index 57af91a5110..7da3f50af2f 100644 --- a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketEndPoint.java +++ b/jetty-unixsocket/jetty-unixsocket-common/src/main/java/org/eclipse/jetty/unixsocket/common/UnixSocketEndPoint.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.unixsocket; +package org.eclipse.jetty.unixsocket.common; import java.io.IOException; import java.net.InetSocketAddress; diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/JnrTest.java b/jetty-unixsocket/jetty-unixsocket-common/src/test/java/org/eclipse/jetty/unixsocket/common/JnrTest.java similarity index 98% rename from jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/JnrTest.java rename to jetty-unixsocket/jetty-unixsocket-common/src/test/java/org/eclipse/jetty/unixsocket/common/JnrTest.java index ecff07eb60f..b13a5228656 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/JnrTest.java +++ b/jetty-unixsocket/jetty-unixsocket-common/src/test/java/org/eclipse/jetty/unixsocket/common/JnrTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.unixsocket; +package org.eclipse.jetty.unixsocket.common; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; @@ -36,8 +36,7 @@ public class JnrTest java.io.File path = new java.io.File("/tmp/fubar.sock"); path.deleteOnExit(); UnixSocketAddress address = new UnixSocketAddress(path); - - + UnixServerSocketChannel serverChannel = UnixServerSocketChannel.open(); Selector serverSelector = NativeSelectorProvider.getInstance().openSelector(); serverChannel.configureBlocking(false); @@ -74,7 +73,6 @@ public class JnrTest buffer.flip(); System.err.printf("server read=%d%n",read); - selected = clientSelector.selectNow(); System.err.printf("clientSelected=%d %s%n",selected,clientSelector.selectedKeys()); @@ -92,8 +90,6 @@ public class JnrTest buffer.flip(); System.err.printf("server read=%d '%s'%n",read,new String(buffer.array(),0,buffer.limit(),StandardCharsets.ISO_8859_1)); - - selected = clientSelector.selectNow(); System.err.printf("clientSelected=%d %s%n",selected,clientSelector.selectedKeys()); @@ -116,10 +112,8 @@ public class JnrTest buffer.flip(); System.err.printf("client read=%d '%s'%n",read,new String(buffer.array(),0,buffer.limit(),StandardCharsets.ISO_8859_1)); - System.err.println("So far so good.... now it gets strange..."); - - + // Let's write until flow control hit int size = buffer.capacity(); @@ -141,8 +135,6 @@ public class JnrTest } System.err.printf("server wrote %d before flow control%n",written); - - selected = clientSelector.selectNow(); System.err.printf("clientSelected=%d %s%n",selected,clientSelector.selectedKeys()); @@ -156,10 +148,7 @@ public class JnrTest buffer.flip(); System.err.printf("client read=%d '%s'%n",read,new String(buffer.array(),0,buffer.limit(),StandardCharsets.ISO_8859_1)); - server.close(); client.close(); - } - } diff --git a/jetty-unixsocket/jetty-unixsocket-server/pom.xml b/jetty-unixsocket/jetty-unixsocket-server/pom.xml new file mode 100644 index 00000000000..ca8f5b69fe9 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-server/pom.xml @@ -0,0 +1,32 @@ + + + + jetty-unixsocket + org.eclipse.jetty + 10.0.0-SNAPSHOT + + + 4.0.0 + jetty-unixsocket-server + Jetty :: UnixSocket :: Server + + + ${project.groupId}.unixsocket.server + + + + + org.eclipse.jetty + jetty-unixsocket-common + ${project.version} + + + org.eclipse.jetty + jetty-server + ${project.version} + + + + diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-forwarded.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-forwarded.xml similarity index 96% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket-forwarded.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-forwarded.xml index d30ea10a51c..f096db547cb 100644 --- a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-forwarded.xml +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-forwarded.xml @@ -1,5 +1,6 @@ - + + diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http.xml similarity index 84% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http.xml index 0520c345b3d..492202b28aa 100644 --- a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http.xml +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http.xml @@ -1,7 +1,7 @@ - + - + diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http2c.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http2c.xml similarity index 73% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http2c.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http2c.xml index 40494fd5c79..caafabea480 100644 --- a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-http2c.xml +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-http2c.xml @@ -1,10 +1,7 @@ - - - - + diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-proxy-protocol.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-proxy-protocol.xml similarity index 100% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket-proxy-protocol.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-proxy-protocol.xml diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-secure.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-secure.xml similarity index 89% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket-secure.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-secure.xml index 2a053233ccc..03a1467800b 100644 --- a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket-secure.xml +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket-secure.xml @@ -1,5 +1,6 @@ - + + diff --git a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket.xml b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket.xml similarity index 74% rename from jetty-unixsocket/src/main/config/etc/jetty-unixsocket.xml rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket.xml index ecf1f43bb63..9eb92e9d3e8 100644 --- a/jetty-unixsocket/src/main/config/etc/jetty-unixsocket.xml +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/etc/jetty-unixsocket.xml @@ -1,4 +1,4 @@ - + @@ -8,14 +8,10 @@ - + - - - - - + diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket-forwarded.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-forwarded.mod similarity index 100% rename from jetty-unixsocket/src/main/config/modules/unixsocket-forwarded.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-forwarded.mod diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket-http.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-http.mod similarity index 100% rename from jetty-unixsocket/src/main/config/modules/unixsocket-http.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-http.mod diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket-http2c.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-http2c.mod similarity index 100% rename from jetty-unixsocket/src/main/config/modules/unixsocket-http2c.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-http2c.mod diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket-proxy-protocol.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-proxy-protocol.mod similarity index 100% rename from jetty-unixsocket/src/main/config/modules/unixsocket-proxy-protocol.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-proxy-protocol.mod diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket-secure.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-secure.mod similarity index 100% rename from jetty-unixsocket/src/main/config/modules/unixsocket-secure.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket-secure.mod diff --git a/jetty-unixsocket/src/main/config/modules/unixsocket.mod b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket.mod similarity index 91% rename from jetty-unixsocket/src/main/config/modules/unixsocket.mod rename to jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket.mod index 84a45d21831..a66fbdf9f6d 100644 --- a/jetty-unixsocket/src/main/config/modules/unixsocket.mod +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/config/modules/unixsocket.mod @@ -38,7 +38,7 @@ lib/jetty-unixsocket-${jetty.version}.jar lib/jnr/*.jar [license] -Jetty UnixSockets is implmented using the Java Native Runtime, which is an +Jetty UnixSockets is implemented using the Java Native Runtime, which is an open source project hosted on Github and released under the Apache 2.0 license. https://github.com/jnr/jnr-unixsocket http://www.apache.org/licenses/LICENSE-2.0.html @@ -46,13 +46,13 @@ http://www.apache.org/licenses/LICENSE-2.0.html [ini-template] ### Unix SocketHTTP Connector Configuration -## Connector host/address to bind to -# jetty.unixsocket=/tmp/jetty.sock +## Unix socket path to bind to +# jetty.unixsocket.path=/tmp/jetty.sock ## Connector idle timeout in milliseconds # jetty.unixsocket.idleTimeout=30000 -## Number of selectors (-1 picks default 1) +## Number of selectors (-1 picks default) # jetty.unixsocket.selectors=-1 ## ServerSocketChannel backlog (0 picks platform default) diff --git a/jetty-unixsocket/jetty-unixsocket-server/src/main/java/module-info.java b/jetty-unixsocket/jetty-unixsocket-server/src/main/java/module-info.java new file mode 100644 index 00000000000..ce01b696bb9 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/java/module-info.java @@ -0,0 +1,29 @@ +// +// ======================================================================== +// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +module org.eclipse.jetty.unixsocket.server +{ + exports org.eclipse.jetty.unixsocket.server; + + requires jnr.enxio; + requires jnr.unixsocket; + requires org.eclipse.jetty.io; + requires org.eclipse.jetty.server; + requires org.eclipse.jetty.unixsocket.common; + requires org.eclipse.jetty.util; +} diff --git a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketConnector.java b/jetty-unixsocket/jetty-unixsocket-server/src/main/java/org/eclipse/jetty/unixsocket/server/UnixSocketConnector.java similarity index 63% rename from jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketConnector.java rename to jetty-unixsocket/jetty-unixsocket-server/src/main/java/org/eclipse/jetty/unixsocket/server/UnixSocketConnector.java index 7767e772097..4bdbee1a384 100644 --- a/jetty-unixsocket/src/main/java/org/eclipse/jetty/unixsocket/UnixSocketConnector.java +++ b/jetty-unixsocket/jetty-unixsocket-server/src/main/java/org/eclipse/jetty/unixsocket/server/UnixSocketConnector.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.unixsocket; +package org.eclipse.jetty.unixsocket.server; import java.io.File; import java.io.IOException; @@ -28,8 +28,11 @@ import java.nio.channels.Selector; import java.nio.file.Files; import java.nio.file.Paths; import java.util.concurrent.Executor; -import java.util.concurrent.Future; +import jnr.enxio.channels.NativeSelectorProvider; +import jnr.unixsocket.UnixServerSocketChannel; +import jnr.unixsocket.UnixSocketAddress; +import jnr.unixsocket.UnixSocketChannel; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -41,6 +44,7 @@ import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.SslConnectionFactory; +import org.eclipse.jetty.unixsocket.common.UnixSocketEndPoint; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.Name; @@ -49,153 +53,123 @@ import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.Scheduler; -import jnr.enxio.channels.NativeSelectorProvider; -import jnr.unixsocket.UnixServerSocketChannel; -import jnr.unixsocket.UnixSocketAddress; -import jnr.unixsocket.UnixSocketChannel; - -/** - * - */ @ManagedObject("Connector using UNIX Socket") public class UnixSocketConnector extends AbstractConnector { + // See SockAddrUnix.ADDR_LENGTH. + public static final int MAX_UNIX_SOCKET_PATH_LENGTH = 107; private static final Logger LOG = Log.getLogger(UnixSocketConnector.class); - + private final SelectorManager _manager; private String _unixSocket = "/tmp/jetty.sock"; private volatile UnixServerSocketChannel _acceptChannel; private volatile int _acceptQueueSize = 0; private volatile boolean _reuseAddress = true; - - /* ------------------------------------------------------------ */ - /** HTTP Server Connection. + /** + * HTTP Server Connection. *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.

- * @param server The {@link Server} this connector will accept connection for. + * + * @param server The {@link Server} this connector will accept connection for. */ - public UnixSocketConnector( @Name("server") Server server) + public UnixSocketConnector(@Name("server") Server server) { - this(server,null,null,null,-1,new HttpConnectionFactory()); - } - - /* ------------------------------------------------------------ */ - /** HTTP Server Connection. - *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.

- * @param server The {@link Server} this connector will accept connection for. - * @param selectors - * the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. - */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("selectors") int selectors) - { - this(server,null,null,null,selectors,new HttpConnectionFactory()); - } - - /* ------------------------------------------------------------ */ - /** HTTP Server Connection. - *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.

- * @param server The {@link Server} this connector will accept connection for. - * @param selectors - * the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. - * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. - */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("selectors") int selectors, - @Name("factories") ConnectionFactory... factories) - { - this(server,null,null,null,selectors,factories); + this(server, -1); } - /* ------------------------------------------------------------ */ - /** Generic Server Connection with default configuration. + /** + * HTTP Server Connection. + *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.

+ * + * @param server The {@link Server} this connector will accept connection for. + * @param selectors the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. + */ + public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors) + { + this(server, selectors, new HttpConnectionFactory()); + } + + /** + * Generic Server Connection with default configuration. *

Construct a Server Connector with the passed Connection factories.

- * @param server The {@link Server} this connector will accept connection for. + * + * @param server The {@link Server} this connector will accept connection for. * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("factories") ConnectionFactory... factories) + public UnixSocketConnector(@Name("server") Server server, @Name("factories") ConnectionFactory... factories) { - this(server,null,null,null,-1,factories); + this(server, -1, factories); } - /* ------------------------------------------------------------ */ - /** HTTP Server Connection. - *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the primary protocol

. - * @param server The {@link Server} this connector will accept connection for. - * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the - * list of HTTP Connection Factory. - */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("sslContextFactory") SslContextFactory sslContextFactory) - { - this(server,null,null,null,-1,AbstractConnectionFactory.getFactories(sslContextFactory,new HttpConnectionFactory())); - } - - /* ------------------------------------------------------------ */ - /** HTTP Server Connection. - *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the primary protocol

. - * @param server The {@link Server} this connector will accept connection for. - * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the - * list of HTTP Connection Factory. - * @param selectors - * the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. - */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("selectors") int selectors, - @Name("sslContextFactory") SslContextFactory sslContextFactory) - { - this(server,null,null,null,selectors,AbstractConnectionFactory.getFactories(sslContextFactory,new HttpConnectionFactory())); - } - - /* ------------------------------------------------------------ */ - /** Generic SSL Server Connection. - * @param server The {@link Server} this connector will accept connection for. - * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the - * list of ConnectionFactories, with the first factory being the default protocol for the SslConnectionFactory. + /** + * HTTP Server Connection. + *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.

+ * + * @param server The {@link Server} this connector will accept connection for. + * @param selectors the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("sslContextFactory") SslContextFactory sslContextFactory, - @Name("factories") ConnectionFactory... factories) + public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors, @Name("factories") ConnectionFactory... factories) + { + this(server, null, null, null, selectors, factories); + } + + /** + * HTTP Server Connection. + *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the primary protocol

. + * + * @param server The {@link Server} this connector will accept connection for. + * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the + * list of HTTP Connection Factory. + */ + public UnixSocketConnector(@Name("server") Server server, @Name("sslContextFactory") SslContextFactory sslContextFactory) + { + this(server, -1, sslContextFactory); + } + + /** + * HTTP Server Connection. + *

Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the primary protocol

. + * + * @param server The {@link Server} this connector will accept connection for. + * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the + * list of HTTP Connection Factory. + * @param selectors the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. + */ + public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors, @Name("sslContextFactory") SslContextFactory sslContextFactory) + { + this(server, null, null, null, selectors, AbstractConnectionFactory.getFactories(sslContextFactory, new HttpConnectionFactory())); + } + + /** + * Generic SSL Server Connection. + * + * @param server The {@link Server} this connector will accept connection for. + * @param sslContextFactory If non null, then a {@link SslConnectionFactory} is instantiated and prepended to the + * list of ConnectionFactories, with the first factory being the default protocol for the SslConnectionFactory. + * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. + */ + public UnixSocketConnector(@Name("server") Server server, @Name("sslContextFactory") SslContextFactory sslContextFactory, @Name("factories") ConnectionFactory... factories) { this(server, null, null, null, -1, AbstractConnectionFactory.getFactories(sslContextFactory, factories)); } - /** Generic Server Connection. - * @param server - * The server this connector will be accept connection for. - * @param executor - * An executor used to run tasks for handling requests, acceptors and selectors. - * If null then use the servers executor - * @param scheduler - * A scheduler used to schedule timeouts. If null then use the servers scheduler - * @param bufferPool - * A ByteBuffer pool used to allocate buffers. If null then create a private pool with default configuration. - * @param selectors - * the number of selector threads, or <=0 for a default value(1). Selectors notice and schedule established connection that can make IO progress. - * @param factories - * Zero or more {@link ConnectionFactory} instances used to create and configure connections. + /** + * Generic Server Connection. + * + * @param server The server this connector will be accept connection for. + * @param executor An executor used to run tasks for handling requests, acceptors and selectors. + * If null then use the servers executor + * @param scheduler A scheduler used to schedule timeouts. If null then use the servers scheduler + * @param bufferPool A ByteBuffer pool used to allocate buffers. If null then create a private pool with default configuration. + * @param selectors the number of selector threads, or <=0 for a default value(1). Selectors notice and schedule established connection that can make IO progress. + * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. */ - public UnixSocketConnector( - @Name("server") Server server, - @Name("executor") Executor executor, - @Name("scheduler") Scheduler scheduler, - @Name("bufferPool") ByteBufferPool bufferPool, - @Name("selectors") int selectors, - @Name("factories") ConnectionFactory... factories) + public UnixSocketConnector(@Name("server") Server server, @Name("executor") Executor executor, @Name("scheduler") Scheduler scheduler, @Name("bufferPool") ByteBufferPool bufferPool, @Name("selectors") int selectors, @Name("factories") ConnectionFactory... factories) { - super(server,executor,scheduler,bufferPool,0,factories); - _manager = newSelectorManager(getExecutor(), getScheduler(), - selectors>0?selectors:1); + super(server, executor, scheduler, bufferPool, 0, factories); + _manager = newSelectorManager(getExecutor(), getScheduler(), selectors > 0 ? selectors : 1); addBean(_manager, true); - setAcceptorPriorityDelta(-2); } @ManagedAttribute @@ -203,10 +177,12 @@ public class UnixSocketConnector extends AbstractConnector { return _unixSocket; } - + public void setUnixSocket(String filename) { - _unixSocket=filename; + if (filename.length() > MAX_UNIX_SOCKET_PATH_LENGTH) + throw new IllegalArgumentException("Unix socket path too long"); + _unixSocket = filename; } protected SelectorManager newSelectorManager(Executor executor, Scheduler scheduler, int selectors) @@ -219,11 +195,10 @@ public class UnixSocketConnector extends AbstractConnector { open(); super.doStart(); - - if (getAcceptors()==0) + if (getAcceptors() == 0) _manager.acceptor(_acceptChannel); } - + @Override protected void doStop() throws Exception { @@ -231,13 +206,6 @@ public class UnixSocketConnector extends AbstractConnector close(); } - public boolean isOpen() - { - UnixServerSocketChannel channel = _acceptChannel; - return channel!=null && channel.isOpen(); - } - - public void open() throws IOException { if (_acceptChannel == null) @@ -246,8 +214,7 @@ public class UnixSocketConnector extends AbstractConnector file.deleteOnExit(); SocketAddress bindAddress = new UnixSocketAddress(file); UnixServerSocketChannel serverChannel = UnixServerSocketChannel.open(); - - serverChannel.configureBlocking(getAcceptors()>0); + serverChannel.configureBlocking(getAcceptors() > 0); try { serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); @@ -259,18 +226,11 @@ public class UnixSocketConnector extends AbstractConnector } addBean(serverChannel); if (LOG.isDebugEnabled()) - LOG.debug("opened {}",serverChannel); + LOG.debug("opened {}", serverChannel); _acceptChannel = serverChannel; } } - @Override - public Future shutdown() - { - // shutdown all the connections - return super.shutdown(); - } - public void close() { UnixServerSocketChannel serverChannel = _acceptChannel; @@ -297,7 +257,7 @@ public class UnixSocketConnector extends AbstractConnector { Files.deleteIfExists(Paths.get(_unixSocket)); } - catch ( IOException e ) + catch (IOException e) { LOG.warn(e); } @@ -311,16 +271,16 @@ public class UnixSocketConnector extends AbstractConnector UnixServerSocketChannel serverChannel = _acceptChannel; if (serverChannel != null && serverChannel.isOpen()) { - LOG.debug("accept {}",serverChannel); + LOG.debug("accept {}", serverChannel); UnixSocketChannel channel = serverChannel.accept(); - LOG.debug("accepted {}",channel); + LOG.debug("accepted {}", channel); accepted(channel); } } - + protected void accepted(UnixSocketChannel channel) throws IOException { - channel.configureBlocking(false); + channel.configureBlocking(false); _manager.accept(channel); } @@ -337,10 +297,9 @@ public class UnixSocketConnector extends AbstractConnector protected UnixSocketEndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey key) throws IOException { - return new UnixSocketEndPoint((UnixSocketChannel)channel,selector,key,getScheduler()); + return new UnixSocketEndPoint((UnixSocketChannel)channel, selector, key, getScheduler()); } - /** * @return the accept queue size */ @@ -376,7 +335,6 @@ public class UnixSocketConnector extends AbstractConnector _reuseAddress = reuseAddress; } - @Override public String toString() { @@ -384,7 +342,7 @@ public class UnixSocketConnector extends AbstractConnector super.toString(), _unixSocket); } - + protected class UnixSocketConnectorManager extends SelectorManager { public UnixSocketConnectorManager(Executor executor, Scheduler scheduler, int selectors) @@ -403,7 +361,7 @@ public class UnixSocketConnector extends AbstractConnector { return NativeSelectorProvider.getInstance().openSelector(); } - + @Override protected EndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey selectionKey) throws IOException { @@ -448,10 +406,10 @@ public class UnixSocketConnector extends AbstractConnector protected SelectableChannel doAccept(SelectableChannel server) throws IOException { if (LOG.isDebugEnabled()) - LOG.debug("doAccept async {}",server); + LOG.debug("doAccept async {}", server); UnixSocketChannel channel = ((UnixServerSocketChannel)server).accept(); if (LOG.isDebugEnabled()) - LOG.debug("accepted async {}",channel); + LOG.debug("accepted async {}", channel); return channel; } } diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java b/jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java similarity index 98% rename from jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java rename to jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java index ce88a7acf2f..886ac885570 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java +++ b/jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketProxyServer.java @@ -34,6 +34,7 @@ import org.eclipse.jetty.server.ProxyConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; public class UnixSocketProxyServer { diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java b/jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java similarity index 95% rename from jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java rename to jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java index 4323fa8767e..0705667dbfa 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java +++ b/jetty-unixsocket/jetty-unixsocket-server/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketServer.java @@ -25,15 +25,14 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Date; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.HttpConnectionFactory; -import org.eclipse.jetty.server.ProxyConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; public class UnixSocketServer { @@ -53,7 +52,7 @@ public class UnixSocketServer { @Override protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException + throws IOException { int l = 0; if (request.getContentLength()!=0) diff --git a/jetty-unixsocket/jetty-unixsocket-server/src/test/resources/jetty-logging.properties b/jetty-unixsocket/jetty-unixsocket-server/src/test/resources/jetty-logging.properties new file mode 100644 index 00000000000..f6dad82a697 --- /dev/null +++ b/jetty-unixsocket/jetty-unixsocket-server/src/test/resources/jetty-logging.properties @@ -0,0 +1,3 @@ +org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog +#org.eclipse.jetty.LEVEL=DEBUG +#org.eclipse.jetty.unixsocket.LEVEL=DEBUG diff --git a/jetty-unixsocket/pom.xml b/jetty-unixsocket/pom.xml index de9e9ea1684..29fd16bab8a 100644 --- a/jetty-unixsocket/pom.xml +++ b/jetty-unixsocket/pom.xml @@ -1,48 +1,21 @@ - + org.eclipse.jetty jetty-project 10.0.0-SNAPSHOT + 4.0.0 jetty-unixsocket + pom Jetty :: UnixSocket - Jetty UnixSocket - http://www.eclipse.org/jetty - - ${project.groupId}.unixsocket - - - - - org.codehaus.mojo - findbugs-maven-plugin - - org.eclipse.jetty.unixsocket.* - - - - - - - org.eclipse.jetty - jetty-server - ${project.version} - - - com.github.jnr - jnr-unixsocket - - - org.eclipse.jetty - jetty-client - ${project.version} - provided - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - + Jetty UnixSocket Parent + + + jetty-unixsocket-common + jetty-unixsocket-client + jetty-unixsocket-server + + diff --git a/jetty-unixsocket/src/test/resources/haproxy b/jetty-unixsocket/src/test/resources/haproxy deleted file mode 100755 index 73db7b00b8e..00000000000 Binary files a/jetty-unixsocket/src/test/resources/haproxy and /dev/null differ diff --git a/jetty-unixsocket/src/test/resources/jetty-logging.properties b/jetty-unixsocket/src/test/resources/jetty-logging.properties deleted file mode 100644 index 46f8e39c33f..00000000000 --- a/jetty-unixsocket/src/test/resources/jetty-logging.properties +++ /dev/null @@ -1,8 +0,0 @@ -org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -#org.eclipse.jetty.LEVEL=DEBUG -#org.eclipse.jetty.client.LEVEL=DEBUG -#org.eclipse.jetty.proxy.LEVEL=DEBUG -#org.eclipse.jetty.unixsocket.LEVEL=DEBUG -#org.eclipse.jetty.io.LEVEL=DEBUG -#org.eclipse.jetty.server.ProxyConnectionFactory.LEVEL=DEBUG -#org.eclipse.jetty.unixsocket.LEVEL=DEBUG \ No newline at end of file diff --git a/pom.xml b/pom.xml index c3e7f679eef..f4deea93706 100644 --- a/pom.xml +++ b/pom.xml @@ -1034,7 +1034,7 @@ com.github.jnr jnr-unixsocket - 0.20 + 0.22 junit diff --git a/tests/test-http-client-transport/pom.xml b/tests/test-http-client-transport/pom.xml index 7e909f8621a..3edc69bc67a 100644 --- a/tests/test-http-client-transport/pom.xml +++ b/tests/test-http-client-transport/pom.xml @@ -86,7 +86,13 @@ org.eclipse.jetty - jetty-unixsocket + jetty-unixsocket-client + ${project.version} + test + + + org.eclipse.jetty + jetty-unixsocket-server ${project.version} test diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java index b5ef43875c7..f8dfac7e440 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/AsyncIOServletTest.java @@ -18,20 +18,6 @@ package org.eclipse.jetty.http.client; -import static java.nio.ByteBuffer.wrap; -import static org.eclipse.jetty.http.client.Transport.FCGI; -import static org.eclipse.jetty.util.BufferUtil.toArray; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -85,7 +71,7 @@ import org.eclipse.jetty.server.HttpInput.Content; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler.Context; -import org.eclipse.jetty.unixsocket.UnixSocketConnector; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.FuturePromise; import org.eclipse.jetty.util.log.StacklessLogging; @@ -96,6 +82,20 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ArgumentsSource; +import static java.nio.ByteBuffer.wrap; +import static org.eclipse.jetty.http.client.Transport.FCGI; +import static org.eclipse.jetty.util.BufferUtil.toArray; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + public class AsyncIOServletTest extends AbstractTest { @Override diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java index a0ee475b519..4210cdb487e 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java @@ -53,8 +53,8 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.AbstractHandler; -import org.eclipse.jetty.unixsocket.UnixSocketConnector; import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.LeakDetector; import org.eclipse.jetty.util.ProcessorUtils; diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java index 93d9031fff2..1e05572229f 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java @@ -56,8 +56,8 @@ import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.unixsocket.UnixSocketConnector; import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets; +import org.eclipse.jetty.unixsocket.server.UnixSocketConnector; import org.eclipse.jetty.util.BlockingArrayQueue; import org.eclipse.jetty.util.SocketAddressResolver; import org.eclipse.jetty.util.log.Log;