|
@@ -36,6 +36,7 @@ import java.net.InetSocketAddress;
|
|
|
import java.security.PrivilegedAction;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
|
|
|
|
+import org.apache.hadoop.net.NetUtils;
|
|
|
import org.junit.Assert;
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
@@ -235,8 +236,8 @@ public class TestClientRMTokens {
|
|
|
@Test
|
|
|
public void testShortCircuitRenewCancel()
|
|
|
throws IOException, InterruptedException {
|
|
|
- InetSocketAddress addr =
|
|
|
- new InetSocketAddress(InetAddress.getLocalHost(), 123);
|
|
|
+ InetSocketAddress addr = NetUtils.createSocketAddr(
|
|
|
+ InetAddress.getLocalHost().getHostName(), 123, null);
|
|
|
checkShortCircuitRenewCancel(addr, addr, true);
|
|
|
}
|
|
|
|
|
@@ -244,17 +245,19 @@ public class TestClientRMTokens {
|
|
|
public void testShortCircuitRenewCancelWildcardAddress()
|
|
|
throws IOException, InterruptedException {
|
|
|
InetSocketAddress rmAddr = new InetSocketAddress(123);
|
|
|
+ InetSocketAddress serviceAddr = NetUtils.createSocketAddr(
|
|
|
+ InetAddress.getLocalHost().getHostName(), rmAddr.getPort(), null);
|
|
|
checkShortCircuitRenewCancel(
|
|
|
rmAddr,
|
|
|
- new InetSocketAddress(InetAddress.getLocalHost(), rmAddr.getPort()),
|
|
|
+ serviceAddr,
|
|
|
true);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testShortCircuitRenewCancelSameHostDifferentPort()
|
|
|
throws IOException, InterruptedException {
|
|
|
- InetSocketAddress rmAddr =
|
|
|
- new InetSocketAddress(InetAddress.getLocalHost(), 123);
|
|
|
+ InetSocketAddress rmAddr = NetUtils.createSocketAddr(
|
|
|
+ InetAddress.getLocalHost().getHostName(), 123, null);
|
|
|
checkShortCircuitRenewCancel(
|
|
|
rmAddr,
|
|
|
new InetSocketAddress(rmAddr.getAddress(), rmAddr.getPort()+1),
|
|
@@ -264,8 +267,8 @@ public class TestClientRMTokens {
|
|
|
@Test
|
|
|
public void testShortCircuitRenewCancelDifferentHostSamePort()
|
|
|
throws IOException, InterruptedException {
|
|
|
- InetSocketAddress rmAddr =
|
|
|
- new InetSocketAddress(InetAddress.getLocalHost(), 123);
|
|
|
+ InetSocketAddress rmAddr = NetUtils.createSocketAddr(
|
|
|
+ InetAddress.getLocalHost().getHostName(), 123, null);
|
|
|
checkShortCircuitRenewCancel(
|
|
|
rmAddr,
|
|
|
new InetSocketAddress("1.1.1.1", rmAddr.getPort()),
|
|
@@ -275,8 +278,8 @@ public class TestClientRMTokens {
|
|
|
@Test
|
|
|
public void testShortCircuitRenewCancelDifferentHostDifferentPort()
|
|
|
throws IOException, InterruptedException {
|
|
|
- InetSocketAddress rmAddr =
|
|
|
- new InetSocketAddress(InetAddress.getLocalHost(), 123);
|
|
|
+ InetSocketAddress rmAddr = NetUtils.createSocketAddr(
|
|
|
+ InetAddress.getLocalHost().getHostName(), 123, null);
|
|
|
checkShortCircuitRenewCancel(
|
|
|
rmAddr,
|
|
|
new InetSocketAddress("1.1.1.1", rmAddr.getPort()+1),
|