public ByteBuffer decode(ByteBuffer buf) throws IgniteCheckedException, SSLException {
  inNetBuf.clear();
  if (buf.limit() > inNetBuf.remaining()) {
    inNetBuf=expandBuffer(inNetBuf,inNetBuf.capacity() + buf.limit() * 2);
    appBuf=expandBuffer(appBuf,inNetBuf.capacity() * 2);
    if (log.isDebugEnabled())     log.debug("Expanded buffers [inNetBufCapacity=" + inNetBuf.capacity() + ", appBufCapacity="+ appBuf.capacity()+ ']');
  }
  inNetBuf.put(buf);
  if (!handshakeFinished)   handshake();
 else   unwrapData();
  if (isInboundDone()) {
    int newPosition=buf.position() - inNetBuf.position();
    if (newPosition >= 0) {
      buf.position(newPosition);
      if (buf.hasRemaining())       U.warn(log,"Got unread bytes after receiving close_notify message (will ignore).");
    }
    inNetBuf.clear();
  }
  appBuf.flip();
  return appBuf;
}

public ByteBuffer decode ( ByteBuffer buf ) throws IgniteCheckedException , SSLException { inNetBuf . clear ( ) ; if ( buf . limit ( ) > inNetBuf . remaining ( ) ) { inNetBuf = expandBuffer ( inNetBuf , inNetBuf . capacity ( ) + buf . limit ( ) * 2 ) ; appBuf = expandBuffer ( appBuf , inNetBuf . capacity ( ) * 2 ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Expanded buffers [inNetBufCapacity=" + inNetBuf . capacity ( ) + ", appBufCapacity=" + appBuf . capacity ( ) + ']' ) ; } inNetBuf . put ( buf ) ; if ( ! handshakeFinished ) handshake ( ) ; else unwrapData ( ) ; if ( isInboundDone ( ) ) { int newPosition = buf . position ( ) - inNetBuf . position ( ) ; if ( newPosition >= 0 ) { buf . position ( newPosition ) ; if ( buf . hasRemaining ( ) ) U . warn ( log , "Got unread bytes after receiving close_notify message (will ignore)." ) ; } inNetBuf . clear ( ) ; } appBuf . flip ( ) ; return appBuf ; }
called by ssl filter when new message was received .
