Created
April 23, 2012 14:30
-
-
Save orls/2471268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetSocketAddress; | |
public class TestDns { | |
public static void main(String[] args) { | |
System.out.println(sun.net.InetAddressCachePolicy.get()); | |
InetSocketAddress unresolved = InetSocketAddress.createUnresolved("10.228.174.223", 8020); | |
System.out.println(unresolved.toString()); // prints 10.228.174.223:8020 | |
System.out.println(unresolved.getHostName()); // prints 10.228.174.223:8020 | |
System.out.println(unresolved.toString()); // prints 10.228.174.223:8020 | |
InetSocketAddress resolved = new InetSocketAddress("10.228.174.223", 8020); | |
System.out.println(resolved.toString()); // prints /10.228.174.223:8020 | |
System.out.println(resolved.getHostName()); // prints ip-10-228-174-223.eu-west-1.compute.interna | |
System.out.println(resolved.toString()); // prints ip-10-228-174-223.eu-west-1.compute.interna/10.228.174.223:8020 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment