Code example for ServerSocket

Methods: bind, close

0
        assertTrue("java.net.ServerSocket ctor must call checkListen on security permissions", s.called);
        assertEquals("Argument of checkListen is not correct", 8888, s.port);    
        ss.close();
         
        s.reset();
        ss = new ServerSocket();
        ss.bind(new InetSocketAddress(0));
        assertTrue("java.net.ServerSocket ctor must call checkListen on security permissions", s.called);
        assertEquals("Argument of checkListen is not correct", 0, s.port);    
        ss.close();
         
        s.reset();
        ss = new ServerSocket(8888, 55, InetAddress.getLocalHost());
        assertTrue("java.net.ServerSocket ctor must call checkListen on security permissions", s.called);
        assertEquals("Argument of checkListen is not correct", 8888, s.port);    
        ss.close();
    } 
}