UnixTestUtils Class — netty Architecture
Architecture documentation for the UnixTestUtils class in UnixTestUtils.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 33f26630_84a7_1769_3f89_9e8d25417235["UnixTestUtils"] 6b23c1ff_c97b_7c16_c4b7_40d665410306["UnixTestUtils.java"] 33f26630_84a7_1769_3f89_9e8d25417235 -->|defined in| 6b23c1ff_c97b_7c16_c4b7_40d665410306 4e8df5de_45f8_fa23_f4b7_411099aecc9f["DomainSocketAddress()"] 33f26630_84a7_1769_3f89_9e8d25417235 -->|method| 4e8df5de_45f8_fa23_f4b7_411099aecc9f 0dbfe9d1_1d22_aed0_fe7d_224fca6fac4c["SocketAddress()"] 33f26630_84a7_1769_3f89_9e8d25417235 -->|method| 0dbfe9d1_1d22_aed0_fe7d_224fca6fac4c aa520b67_d306_88d3_0b4f_cca946d70265["Object()"] 33f26630_84a7_1769_3f89_9e8d25417235 -->|method| aa520b67_d306_88d3_0b4f_cca946d70265 6846f4f1_4e61_b9cc_03e6_655c36a6259a["UnixTestUtils()"] 33f26630_84a7_1769_3f89_9e8d25417235 -->|method| 6846f4f1_4e61_b9cc_03e6_655c36a6259a
Relationship Graph
Source Code
transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/UnixTestUtils.java lines 30–83
public final class UnixTestUtils {
private static final Object INET_LOOPBACK_UNAVAILABLE = new Object();
private static volatile Object inetLoopbackCache;
/**
* @deprecated Use {@link #newDomainSocketAddress()} instead.
*/
@Deprecated
public static DomainSocketAddress newSocketAddress() {
return newDomainSocketAddress();
}
public static DomainSocketAddress newDomainSocketAddress() {
try {
File file;
do {
file = PlatformDependent.createTempFile("NETTY", "UDS", null);
if (!file.delete()) {
throw new IOException("failed to delete: " + file);
}
} while (file.getAbsolutePath().length() > 128);
return new DomainSocketAddress(file);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* The JDK method may produce IPv4 loopback addresses where {@link io.netty.util.NetUtil#LOCALHOST} might be an
* IPv6 addresses.
* This difference can stress the system in different ways that are important to test.
*/
public static SocketAddress newInetLoopbackSocketAddress() {
Object loopback = inetLoopbackCache;
if (loopback == null) {
inetLoopbackCache = loopback = getLoopbackAddress();
}
assumeTrue(loopback != INET_LOOPBACK_UNAVAILABLE, "InetAddress.getLoopbackAddress() is not available");
return new InetSocketAddress((InetAddress) loopback, 0);
}
private static Object getLoopbackAddress() {
try {
Method method = InetAddress.class.getMethod("getLoopbackAddress");
return method.invoke(null);
} catch (Exception ignore) {
return INET_LOOPBACK_UNAVAILABLE;
}
}
private UnixTestUtils() { }
}
Defined In
Source
Frequently Asked Questions
What is the UnixTestUtils class?
UnixTestUtils is a class in the netty codebase, defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/UnixTestUtils.java.
Where is UnixTestUtils defined?
UnixTestUtils is defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/UnixTestUtils.java at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free