private int doRead(ByteBuffer inputBB){ int count = -1; try{ // Read first bytes to avoid continuing if the client // closed the connection. count = ((SocketChannel)key.channel()).read(inputBB); if (count != -1){ // Decrypt the bytes we just read. byteBuffer = SSLUtils.unwrapAll(byteBuffer,inputBB,sslEngine); final SSLWorkerThread workerThread = (SSLWorkerThread)Thread.currentThread(); workerThread.setByteBuffer(byteBuffer); workerThread.setInputBB(inputBB); } return count; } catch(IOException ex){ return -1; } finally { if (count == -1){ try{ sslEngine.closeInbound(); } catch (SSLException ex){ ; } } } }
workerThread.setInputBB(inputBB); workerThread.setOutputBB(outputBB); workerThread.setByteBuffer(byteBuffer);