@Override
    protected String getSocketAddressForNode(MemcachedNode node) {
        String result = socketAddresses.get(node);
        if(result == null) {
            final SocketAddress socketAddress = node.getSocketAddress();
            if(socketAddress instanceof InetSocketAddress) {
                final InetSocketAddress isa = (InetSocketAddress)socketAddress;
                if(poolManager.getDiscoveryClient() != null ) {
                    final DiscoveryClient mgr = poolManager.getDiscoveryClient();
                    final Application app = mgr.getApplication(appId);
                    if(app != null) {
	                    final List<InstanceInfo> instances = app.getInstances();
	                    for(InstanceInfo info : instances) {
	                        final String hostName = info.getHostName();
	                        if(hostName.equalsIgnoreCase(isa.getHostName())) {
	                            final String ip = info.getIPAddr();
	                            String port = info.getMetadata().get("evcache.port");
	                            if(port == null) port = "11211";
	                            result = hostName + '/' + ip + ':' + port;
	                            break;
	                        }
	                    }
                    } else {
                    	result = ((InetSocketAddress)socketAddress).getHostName() + '/' + ((InetSocketAddress)socketAddress).getAddress().getHostAddress() + ":11211";
                    }
                } else {
                    result = ((InetSocketAddress)socketAddress).getHostName() + '/' + ((InetSocketAddress)socketAddress).getAddress().getHostAddress()  + ":11211";
                }
            } else {
                result=String.valueOf(socketAddress);
                if (result.startsWith("/")) {
                    result = result.substring(1);
                }
            }
            socketAddresses.put(node, result);
        }
        return result;
    }
@ Override protected String getSocketAddressForNode ( MemcachedNode node ) { String result = socketAddresses . get ( node ) ; if ( result == null ) { final SocketAddress socketAddress = node . getSocketAddress ( ) ; if ( socketAddress instanceof InetSocketAddress ) { final InetSocketAddress isa = ( InetSocketAddress ) socketAddress ; if ( poolManager . getDiscoveryClient ( ) != null ) { final DiscoveryClient mgr = poolManager . getDiscoveryClient ( ) ; final Application app = mgr . getApplication ( appId ) ; if ( app != null ) { final List < InstanceInfo > instances = app . getInstances ( ) ; for ( InstanceInfo info : instances ) { final String hostName = info . getHostName ( ) ; if ( hostName . equalsIgnoreCase ( isa . getHostName ( ) ) ) { final String ip = info . getIPAddr ( ) ; String port = info . getMetadata ( ) . get ( "evcache.port" ) ; if ( port == null ) port = "11211" ; result = hostName + '/' + ip + ':' + port ; break ; } } } else { result = ( ( InetSocketAddress ) socketAddress ) . getHostName ( ) + '/' + ( ( InetSocketAddress ) socketAddress ) . getAddress ( ) . getHostAddress ( ) + ":11211" ; } } else { result = ( ( InetSocketAddress ) socketAddress ) . getHostName ( ) + '/' + ( ( InetSocketAddress ) socketAddress ) . getAddress ( ) . getHostAddress ( ) + ":11211" ; } } else { result = String . valueOf ( socketAddress ) ; if ( result . startsWith ( "/" ) ) { result = result . substring ( 1 ) ; } } socketAddresses . put ( node , result ) ; } return result ; }
Returns the socket address of a given MemcachedNode.

@param node - The MemcachedNode which we're interested in
@return The socket address of the given node format is of the following
format "publicHostname/privateIp:port" (ex -
ec2-174-129-159-31.compute-1.amazonaws.com/10.125.47.114:11211)