/** * Initialize this object. */ @Override public void initialize(StreamAlgorithm algorithm, boolean useDirectByteBuffer, boolean useByteBufferView){ type = READ_TASK; this.algorithm = algorithm; inputStream = new SSLAsyncStream(); this.useDirectByteBuffer = useDirectByteBuffer; this.useByteBufferView = useByteBufferView; }
@Override protected boolean process() throws IOException{ boolean keepAlive = false; SocketChannel socketChannel = (SocketChannel)key.channel(); Socket socket = socketChannel.socket(); algorithm.setSocketChannel(socketChannel); inputStream.setSelectionKey(key); ((SSLAsyncStream)inputStream).setSslEngine(sslEngine); ((SSLAsyncStream)inputStream).setInputBB(inputBB); // Get a processor task. If the processorTask != null, that means we // failed to load all the bytes in a single channel.read(). if (processorTask == null){ attachProcessor(selectorThread.getProcessorTask()); } // Always true with the NoParsingAlgorithm if (algorithm.parse(byteBuffer)){ return executeProcessorTask(); } else { // Never happens with the default StreamAlgorithm return true; } }