Code example for DatagramChannel

Methods: close, disconnect, isConnected, isOpen

0
     * Test method for 'DatagramChannelImpl.disconnect()' 
     * 
     * @throws IOException 
     */ 
    public void testDisconnect_UnconnectedClosed() throws IOException { 
        assertFalse(this.channel1.isConnected());
        this.channel1.close();
        assertFalse(this.channel1.isOpen());
        assertEquals(this.channel1, this.channel1.disconnect());
        assertFalse(this.channel1.isConnected());
    } 
 
    /** 
     * Test method for 'DatagramChannelImpl.disconnect()' 
     * 
     * @throws IOException 
     */ 
    public void testDisconnect_BlockWithServerChannelClosed() 
            throws IOException { 
        assertTrue(this.channel1.isBlocking());
        connectLocalServer();