Back to project page twawm2.
The source code is released under:
Copyright (c) 2014, afnf All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistr...
If you think the Android project twawm2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.appspot.afnf4199ga.twawm; /* w ww. jav a 2 s . c o m*/ import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Collections; import net.afnf.and.twawm2.DexmakerInstrumentationTestCase; import android.os.Build; import com.appspot.afnf4199ga.utils.Logger; import com.appspot.afnf4199ga.utils.MyStringUtlis; public class HostnameListTest extends DexmakerInstrumentationTestCase { public void testResolve() throws InterruptedException { int failed = 0; // ????????????????????????????????????????????????? if (MyStringUtlis.eqauls(Build.DEVICE, "generic") == false) { Collections.sort(HostnameList.hosts); for (String hostname : HostnameList.hosts) { InetAddress inetAddress = null; try { inetAddress = InetAddress.getByName(hostname); } catch (UnknownHostException e) { failed++; } if (inetAddress == null) { Logger.w(hostname + " failed"); } else { Logger.i(hostname + " " + inetAddress.getHostAddress()); } } } assertEquals(0, failed); } }