Here you can find the source of isLegalPeerAddress(@CheckForNull SocketAddress socketAddress)
@Deprecated public static boolean isLegalPeerAddress(@CheckForNull SocketAddress socketAddress)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; import javax.annotation.CheckForNull; public class Main { @Deprecated // Not happy with this yet. public static boolean isLegalPeerAddress(@CheckForNull SocketAddress socketAddress) { if (socketAddress == null) return false; if (socketAddress instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; InetAddress inetAddress = inetSocketAddress.getAddress(); if (inetAddress == null) return false; if (inetAddress.isAnyLocalAddress()) return false; if (inetAddress.isLoopbackAddress()) return false; if (inetAddress.isMulticastAddress()) return false; }//from w w w.ja v a2s . c o m return true; } }