Code example for ServerSocket

Methods: bind

0
        super.setUp(); 
        ssc = ServerSocketChannel.open();
        ssc.configureBlocking(false);
        ServerSocket ss = ssc.socket();
        InetSocketAddress address = new InetSocketAddress(PORT);
        ss.bind(address);
        selector = Selector.open();
    } 
 
    protected void tearDown() throws Exception { 
        try { 
            ssc.close();
        } catch (Exception e) {
            // do nothing 
        } 
        try { 
            selector.close();
        } catch (Exception e) {
            // do nothing 
        } 
        super.tearDown();