Code example for DatagramChannel

Methods: close, isConnected, isOpen, receive

0
     * Test method for 'DatagramChannelImpl.receive(ByteBuffer)' 
     * 
     * @throws Exception 
     */ 
    public void testReceive_UnconnectedCloseNull() throws Exception { 
        assertFalse(this.channel1.isConnected());
        this.channel1.close();
        assertFalse(this.channel1.isOpen());
        // checking buffer before checking open 
        try { 
            this.channel1.receive(null);
            fail("Should throw a NPE here."); //$NON-NLS-1$
        } catch (NullPointerException e) {
            // OK. 
        } 
    } 
 
    /** 
     * Test method for 'DatagramChannelImpl.receive(ByteBuffer)' 
     * 
     * @throws Exception