public void initialRead ( ) { _isInitialRead = true ; if ( _buffer != null ) { _buffer . release ( ) ; _buffer = null ; } setAndAllocateBuffer ( 1 ) ; configurePreReadBuffer ( 1 ) ; //This if the first read of the ReadListener, which means force the read to go async //We won't get an actual response from this read as it will always come back on another thread _tcpContext . getReadInterface ( ) . setBuffer ( _buffer ) ; _tcpContext . getReadInterface ( ) . read ( 1 , _tcpChannelCallback , true , WCCustomProperties31 . UPGRADE_READ_TIMEOUT ) ; }
This method triggers the initial read on the connection or the read for after the ReadListener . onDataAvailable has run The read done in this method is a forced async read meaning it will always return on another thread The provided callback will be called when the read is completed and that callback will invoke the ReadListener logic .