WangHan
2024-09-12 d5855a4926926698b740bc6c7ba489de47adb68b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import tech.powerjob.common.PowerJobDKey;
import tech.powerjob.common.utils.NetUtils;
import org.junit.jupiter.api.Test;
 
/**
 * NetUtilsTest
 *
 * @author tjq
 * @since 2020/8/8
 */
public class NetUtilsTest {
 
    @Test
    public void testOrigin() {
        System.out.println(NetUtils.getLocalHost4Test());
    }
 
    @Test
    public void testPreferredNetworkInterface() {
        System.setProperty(PowerJobDKey.PREFERRED_NETWORK_INTERFACE, "en5");
        System.out.println(NetUtils.getLocalHost4Test());
    }
 
    @Test
    public void testIgnoredNetworkInterface() {
        System.setProperty(PowerJobDKey.IGNORED_NETWORK_INTERFACE_REGEX, "utun.|llw.");
        System.out.println(NetUtils.getLocalHost4Test());
    }
 
}