fix for: https://issues.apache.org/activemq/browse/AMQCPP-303


git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/trunk@964840 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/activemq-cpp/src/main/decaf/net/InetAddress.cpp b/activemq-cpp/src/main/decaf/net/InetAddress.cpp
index b936090..c61ab79 100644
--- a/activemq-cpp/src/main/decaf/net/InetAddress.cpp
+++ b/activemq-cpp/src/main/decaf/net/InetAddress.cpp
@@ -37,9 +37,6 @@
 const unsigned char InetAddress::loopbackBytes[4] = { 127, 0, 0, 1 };
 const unsigned char InetAddress::anyBytes[4] = { 0, 0, 0, 0 };
 
-const InetAddress InetAddress::LOOPBACK( Inet4Address( "localhost", InetAddress::loopbackBytes, 4 ) );
-const InetAddress InetAddress::ANY( Inet4Address( InetAddress::anyBytes, 4 ) );
-
 ////////////////////////////////////////////////////////////////////////////////
 InetAddress::InetAddress() {
 }
@@ -161,7 +158,7 @@
     apr_status_t result = apr_gethostname( hostname, APRMAXHOSTLEN+1, pool.getAprPool() );
 
     if( result != APR_SUCCESS ) {
-        return InetAddress::LOOPBACK;
+        return getLoopbackAddress();
     }
 
     apr_sockaddr_t* address = NULL;
@@ -195,3 +192,13 @@
 
     return value;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+InetAddress InetAddress::getAnyAddress() {
+    return Inet4Address( "localhost", InetAddress::loopbackBytes, 4 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+InetAddress InetAddress::getLoopbackAddress() {
+    return Inet4Address( InetAddress::anyBytes, 4 );
+}
diff --git a/activemq-cpp/src/main/decaf/net/InetAddress.h b/activemq-cpp/src/main/decaf/net/InetAddress.h
index c7fdb7b..cb5930e 100644
--- a/activemq-cpp/src/main/decaf/net/InetAddress.h
+++ b/activemq-cpp/src/main/decaf/net/InetAddress.h
@@ -36,9 +36,6 @@
         static const unsigned char loopbackBytes[4];
         static const unsigned char anyBytes[4];
 
-        static const InetAddress ANY;
-        static const InetAddress LOOPBACK;
-
     protected:
 
         mutable std::string hostname;
@@ -242,6 +239,10 @@
          */
         static unsigned int bytesToInt( const unsigned char* bytes, int start );
 
+        static InetAddress getAnyAddress();
+
+        static InetAddress getLoopbackAddress();
+
     };
 
 }}