Issue #3180 - Review client support for Unix sockets.
Updated code after reviews. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
0f6496abb3
commit
4cbc933220
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.unixsocket.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
@ -67,7 +68,7 @@ public class HttpClientTransportOverUnixSockets extends HttpClientTransportOverH
|
|||
{
|
||||
InetAddress inet = address.getAddress();
|
||||
if (!inet.isLoopbackAddress() && !inet.isLinkLocalAddress() && !inet.isSiteLocalAddress())
|
||||
throw new IOException("UnixSocket cannot connect to " + address.getHostString());
|
||||
throw new ConnectException("UnixSocket cannot connect to " + address.getHostString());
|
||||
|
||||
UnixSocketAddress unixAddress = new UnixSocketAddress(_unixSocket);
|
||||
channel = UnixSocketChannel.open(unixAddress);
|
||||
|
|
|
@ -20,10 +20,10 @@ package org.eclipse.jetty.http.client;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.ArgumentsProvider;
|
||||
|
@ -37,7 +37,7 @@ public class TransportProvider implements ArgumentsProvider
|
|||
if (!StringUtil.isBlank(transports))
|
||||
return Arrays.stream(transports.split("\\s*,\\s*")).map(Transport::valueOf);
|
||||
|
||||
if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("linux"))
|
||||
if (OS.LINUX.isCurrentOs())
|
||||
return Arrays.stream(Transport.values());
|
||||
|
||||
return EnumSet.complementOf(EnumSet.of(Transport.UNIX_SOCKET)).stream();
|
||||
|
|
Loading…
Reference in New Issue