private static NetworkState buildMobile4gState() {
   final NetworkInfo info = new NetworkInfo(TYPE_WIMAX, 0, null, null);
   info.setDetailedState(DetailedState.CONNECTED, null, null);
   final LinkProperties prop = new LinkProperties();
   prop.setInterfaceName(TEST_IFACE);
   return new NetworkState(info, prop, null);
 }
 private static NetworkState buildMobile3gState(String subscriberId) {
   final NetworkInfo info =
       new NetworkInfo(TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UMTS, null, null);
   info.setDetailedState(DetailedState.CONNECTED, null, null);
   final LinkProperties prop = new LinkProperties();
   prop.setInterfaceName(TEST_IFACE);
   return new NetworkState(info, prop, null, subscriberId);
 }
 private boolean readLinkProperty(String iface) {
   String DhcpPrefix = "dhcp." + iface + ".";
   String ip = SystemProperties.get(DhcpPrefix + "ipaddress");
   String dns1 = SystemProperties.get(DhcpPrefix + "dns1");
   String dns2 = SystemProperties.get(DhcpPrefix + "dns2");
   String gateway = SystemProperties.get(DhcpPrefix + "gateway");
   String mask = SystemProperties.get(DhcpPrefix + "mask");
   if (ip.isEmpty() || gateway.isEmpty()) {
     Log.e(TAG, "readLinkProperty, ip: " + ip + ", gateway: " + gateway + ", can not be empty");
     return false;
   }
   int PrefixLen = countPrefixLength(NetworkUtils.numericToInetAddress(mask).getAddress());
   mLinkProperties.addLinkAddress(
       new LinkAddress(NetworkUtils.numericToInetAddress(ip), PrefixLen));
   RouteInfo ri = new RouteInfo(NetworkUtils.numericToInetAddress(gateway));
   mLinkProperties.addRoute(ri);
   if (!dns1.isEmpty()) mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns1));
   if (!dns2.isEmpty()) mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns2));
   mLinkProperties.setInterfaceName(iface);
   return true;
 }