src/main/java/org/java_websocket/SSLSocketChannel2.java
private int readRemaining( ByteBuffer dst ) throws SSLException {
        if( inData.hasRemaining() ) {
            return transfereTo( inData, dst );
        }
        if( !inData.hasRemaining() )
            inData.clear();
        // test if some bytes left from last read (e.g. BUFFER_UNDERFLOW)
        if( inCrypt.hasRemaining() ) {
            unwrap();
            int amount = transfereTo( inData, dst );
            if (readEngineResult.getStatus() == SSLEngineResult.Status.CLOSED) {
                return -1;
            }
            if( amount > 0 )
                return amount;
        }
        return 0;
    }
private int readRemaining( ByteBuffer dst ) throws SSLException {
        if( inData.hasRemaining() ) {
            return transfereTo( inData, dst );
        }
        if( !inData.hasRemaining() )
            inData.clear();
        // test if some bytes left from last read (e.g. BUFFER_UNDERFLOW)
        if( inCrypt.hasRemaining() ) {
            unwrap();
            int amount = transfereTo( inData, dst );
            if (readEngineResult.getStatus() == SSLEngineResult.Status.CLOSED) {
                return -1;
            }
            if( amount > 0 )
                return amount;
        }
        return 0;
    }
private int readRemaining ( ByteBuffer dst ) throws SSLException { if ( inData . hasRemaining ( ) ) { return transfereTo ( inData , dst ) ; } if ( ! inData . hasRemaining ( ) ) inData . clear ( ) ; // test if some bytes left from last read (e.g. BUFFER_UNDERFLOW) if ( inCrypt . hasRemaining ( ) ) { unwrap ( ) ; int amount = transfereTo ( inData , dst ) ; if ( readEngineResult . getStatus ( ) == SSLEngineResult . Status . CLOSED ) { return - 1 ; } if ( amount > 0 ) return amount ; } return 0 ; }
{@link #read(ByteBuffer)} may not be to leave all buffers(inData, inCrypt)
{