@@ -80,7 +80,7 @@ public void testSetGetUsername() {
80
80
@ Test
81
81
public void testIsReachablePositive () throws IOException , InterruptedException , URISyntaxException {
82
82
// Start simple TCP server on test port.
83
- InetAddress localhostAddr = InetAddress .getLoopbackAddress ();
83
+ InetAddress loopbackAddress = InetAddress .getLoopbackAddress ();
84
84
try (ServerSocket serverSocket = new ServerSocket (0 , 1 )) {
85
85
Thread thread = new Thread (() -> {
86
86
try {
@@ -98,7 +98,7 @@ public void testIsReachablePositive() throws IOException, InterruptedException,
98
98
Socket socket = null ;
99
99
for (int i = 0 ; i < 3 ; i ++) {
100
100
try {
101
- socket = new Socket (localhostAddr , testPort );
101
+ socket = new Socket (loopbackAddress , testPort );
102
102
} catch (IOException e ) {
103
103
Thread .sleep (1000 );
104
104
}
@@ -110,7 +110,7 @@ public void testIsReachablePositive() throws IOException, InterruptedException,
110
110
// Mock getAddresses() to return single localhost IP address and getPort() to return the test port.
111
111
LdapServer server = new LdapServer ("ldaps://foo.bar.com" );
112
112
LdapServer serverSpy = Mockito .spy (server );
113
- Mockito .when (serverSpy .getAddresses (any ())).thenReturn (new InetAddress []{localhostAddr });
113
+ Mockito .when (serverSpy .getAddresses (any ())).thenReturn (new InetAddress []{loopbackAddress });
114
114
doReturn (testPort ).when (serverSpy ).getPort ();
115
115
116
116
// Test reachability.
@@ -124,12 +124,12 @@ public void testIsReachablePositive() throws IOException, InterruptedException,
124
124
125
125
@ Test
126
126
void testsReachableNegative () throws Exception {
127
- InetAddress localhostAddr = InetAddress .getLoopbackAddress ();
127
+ InetAddress loopbackAddress = InetAddress .getLoopbackAddress ();
128
128
129
129
// Mock getAddresses() to return single localhost IP address and getPort() to return the test port.
130
130
LdapServer server = new LdapServer ("ldaps://foo.bar.com" );
131
131
LdapServer serverSpy = Mockito .spy (server );
132
- Mockito .when (serverSpy .getAddresses (any ())).thenReturn (new InetAddress []{localhostAddr });
132
+ Mockito .when (serverSpy .getAddresses (any ())).thenReturn (new InetAddress []{loopbackAddress });
133
133
// port 0 should not be reachable.
134
134
doReturn (0 ).when (serverSpy ).getPort ();
135
135
0 commit comments