Here you can find the source of getConnectionAddress(InetAddress addr)
public static InetAddress getConnectionAddress(InetAddress addr)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { public static InetAddress getConnectionAddress(InetAddress addr) { return addr.isAnyLocalAddress() ? InetAddress.getLoopbackAddress() : addr; }//from w ww . j ava 2s .c o m }