Code example for NotYetConnectedException

0
     * Status check, must be open and connected, for read and write. 
     */ 
    private void checkOpenConnected() throws IOException { 
        checkOpen(); 
        if (!isConnected()) { 
            throw new NotYetConnectedException();
        } 
    } 
 
    /* 
     * Buffer check, must not null 
     */ 
    private void checkNotNull(ByteBuffer source) {
        if (null == source) {
            throw new NullPointerException();
        } 
    } 
 
    /* 
     * Buffer check, must not null and not read only buffer, for read and 
     * receive.