Code example for InetSocketAddress

Methods: isUnresolved

        InetSocketAddress isa3 = new InetSocketAddress("", 8080);
        assertFalse(isa1.hashCode() == isa3.hashCode());
    public void test_isUnresolved() { 
        InetSocketAddress isa1 = new InetSocketAddress("localhost", 80);
        InetSocketAddress sockAddr = new InetSocketAddress("", 1000);
    public void test_getHostString() throws Exception { 
        // When we have a hostname, we'll get it back because that doesn't cost a DNS lookup... 
        InetSocketAddress hasHostname = InetSocketAddress.createUnresolved("some host", 1234);
        assertEquals("some host", hasHostname.getHostString());
        assertEquals("some host", hasHostname.getHostName());
        // When we don't have a hostname, whether or not we do the reverse lookup is the difference 
        // between getHostString and getHostName... 
        InetAddress address = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 });
Stop searching for code, let great code find you!  Add Codota to your java IDE