3636import java .security .PrivilegedAction ;
3737import java .security .PrivilegedExceptionAction ;
3838
39+ import org .apache .hadoop .net .NetUtils ;
3940import org .junit .Assert ;
4041
4142import org .apache .commons .logging .Log ;
@@ -235,26 +236,28 @@ public void testDelegationToken() throws IOException, InterruptedException {
235236 @ Test
236237 public void testShortCircuitRenewCancel ()
237238 throws IOException , InterruptedException {
238- InetSocketAddress addr =
239- new InetSocketAddress ( InetAddress .getLocalHost (), 123 );
239+ InetSocketAddress addr = NetUtils . createSocketAddr (
240+ InetAddress .getLocalHost (). getHostName () , 123 , null );
240241 checkShortCircuitRenewCancel (addr , addr , true );
241242 }
242243
243244 @ Test
244245 public void testShortCircuitRenewCancelWildcardAddress ()
245246 throws IOException , InterruptedException {
246247 InetSocketAddress rmAddr = new InetSocketAddress (123 );
248+ InetSocketAddress serviceAddr = NetUtils .createSocketAddr (
249+ InetAddress .getLocalHost ().getHostName (), rmAddr .getPort (), null );
247250 checkShortCircuitRenewCancel (
248251 rmAddr ,
249- new InetSocketAddress ( InetAddress . getLocalHost (), rmAddr . getPort ()) ,
252+ serviceAddr ,
250253 true );
251254 }
252255
253256 @ Test
254257 public void testShortCircuitRenewCancelSameHostDifferentPort ()
255258 throws IOException , InterruptedException {
256- InetSocketAddress rmAddr =
257- new InetSocketAddress ( InetAddress .getLocalHost (), 123 );
259+ InetSocketAddress rmAddr = NetUtils . createSocketAddr (
260+ InetAddress .getLocalHost (). getHostName () , 123 , null );
258261 checkShortCircuitRenewCancel (
259262 rmAddr ,
260263 new InetSocketAddress (rmAddr .getAddress (), rmAddr .getPort ()+1 ),
@@ -264,8 +267,8 @@ public void testShortCircuitRenewCancelSameHostDifferentPort()
264267 @ Test
265268 public void testShortCircuitRenewCancelDifferentHostSamePort ()
266269 throws IOException , InterruptedException {
267- InetSocketAddress rmAddr =
268- new InetSocketAddress ( InetAddress .getLocalHost (), 123 );
270+ InetSocketAddress rmAddr = NetUtils . createSocketAddr (
271+ InetAddress .getLocalHost (). getHostName () , 123 , null );
269272 checkShortCircuitRenewCancel (
270273 rmAddr ,
271274 new InetSocketAddress ("1.1.1.1" , rmAddr .getPort ()),
@@ -275,8 +278,8 @@ public void testShortCircuitRenewCancelDifferentHostSamePort()
275278 @ Test
276279 public void testShortCircuitRenewCancelDifferentHostDifferentPort ()
277280 throws IOException , InterruptedException {
278- InetSocketAddress rmAddr =
279- new InetSocketAddress ( InetAddress .getLocalHost (), 123 );
281+ InetSocketAddress rmAddr = NetUtils . createSocketAddr (
282+ InetAddress .getLocalHost (). getHostName () , 123 , null );
280283 checkShortCircuitRenewCancel (
281284 rmAddr ,
282285 new InetSocketAddress ("1.1.1.1" , rmAddr .getPort ()+1 ),
0 commit comments