protected void readyOutboundPostHandshake ( WsByteBuffer netBuffer , WsByteBuffer decryptedNetBuffer , WsByteBuffer encryptedAppBuffer , HandshakeStatus hsStatus , boolean async ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "readyOutboundPostHandshake, vc=" + getVCHash ( ) ) ; } // Exception to call destroy with in case of bad return code from SSL engine. IOException exception = null ; if ( hsStatus != HandshakeStatus . FINISHED ) { // Handshake failed. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unexpected results of handshake after connect, " + hsStatus ) ; } exception = new IOException ( "Unexpected results of handshake after connect, " + hsStatus ) ; } // PK16095 - take certain actions when the handshake completes getChannel ( ) . onHandshakeFinish ( getSSLEngine ( ) ) ; // Null out the buffer references on the device side so they don't wrongly reused later. getDeviceReadInterface ( ) . setBuffers ( null ) ; // Clean up the buffers. // PI48725 Start // Handshake complete. Now get the request. Use our read interface so unwrap already done. // Check if data exists in the network buffer still. This would be app data beyond handshake. if ( netBuffer . remaining ( ) == 0 || netBuffer . position ( ) == 0 ) { // No app data. Release the netBuffer as it will no longer be used. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Releasing netBuffer: " + netBuffer . hashCode ( ) ) ; } // Null out the buffer references on the device side so they don't wrongly reused later. netBuffer . release ( ) ; } else { // Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "App data exists in netBuffer after handshake: " + netBuffer . remaining ( ) ) ; } this . readInterface . setNetBuffer ( netBuffer ) ; } // PI48725 Finish // Clean up the buffers. decryptedNetBuffer . release ( ) ; encryptedAppBuffer . release ( ) ; // Call appropriate callback if async if ( async ) { if ( exception != null ) { close ( getVirtualConnection ( ) , exception ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling ready method." ) ; } super . ready ( getVirtualConnection ( ) ) ; } } else { if ( exception != null ) { throw exception ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "readyOutboundPostHandshake" ) ; } }
This method is called to handle the results of an SSL handshake . This may be called by a callback or in the same thread as the connect request .