diff options
2 files changed, 13 insertions, 4 deletions
diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java index 89a5dd6..100f799 100644 --- a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java @@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.multivimproxy.common.util.restclient; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.Inet4Address; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory; * <br/> * <p> * </p> - * + * * @author * @version Aug 9, 2016 */ @@ -49,7 +50,7 @@ public abstract class HttpBaseRest implements Restful { protected HttpClient client = null; - private static final String LOCAL_HOST = "127.0.0.1"; + private static final String LOCAL_HOST = Inet4Address.getLoopbackAddress().getHostAddress(); static final String HTTP_PATCH = "PATCH"; @@ -65,7 +66,7 @@ public abstract class HttpBaseRest implements Restful { * Constructor<br/> * <p> * </p> - * + * * @since */ public HttpBaseRest() { @@ -135,7 +136,7 @@ public abstract class HttpBaseRest implements Restful { /** * <br/> - * + * * @param method * @param servicePath * @param restParametes diff --git a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java index 2f9c00d..15b908b 100644 --- a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java +++ b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java @@ -19,6 +19,8 @@ package org.onap.vfc.nfvo.multivimproxy.common.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.net.Inet4Address; + import org.junit.Test; import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulOptions; import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulParametes; @@ -52,6 +54,12 @@ public class RestfulUtilTest { }; } + + @Test + public void findLocalAddress() { + assertEquals("127.0.0.1", Inet4Address.getLoopbackAddress().getHostAddress()); + } + private void mockGetResponseContentReturnNull() { new MockUp<RestfulUtil>() { |