private boolean isAddressAllowed(JPushClientSocket socket)
    {
    	SocketAddress sockAddr = socket.getRemoteAddress();
    	
        if ((sockAddr != null) && (sockAddr instanceof InetSocketAddress))
        {
        	InetSocketAddress inetSockAddr = (InetSocketAddress)sockAddr;
        	byte[] ip = inetSockAddr.getAddress().getAddress();

            List<IPRange> list = isPermitOnly ? permittedIPs : blockedIPs;
            boolean bIsInList = false;
            for (IPRange ipRange : list)
            {
                if (ipRange.isWithin(ip))
                {
                    bIsInList = true;
                    break;
                }
            }

            return isPermitOnly ? bIsInList : !bIsInList;
        }
        else
        {
        	return false;
        }
    }