code: public long processSyncReadRequest(long numBytes, int timeout) throws IOException {
  
          long bytesRead = 0;
          boolean freeJIT = false;
          IOException exThisTime = null;
          immedTimeoutRequested = false;
  
          setJITAllocateAction(false);
          this.jITAllocatedDirect = false;
          // allocate buffers if asked to do so, and none exist
          if (getJITAllocateSize() > 0 && getBuffers() == null) {
              if (oTCPConnLink.getConfig().getAllocateBuffersDirect()) {
                  setBuffer(ChannelFrameworkFactory.getBufferManager().allocateDirect(getJITAllocateSize()));
                  this.jITAllocatedDirect = true;
              } else {
                  setBuffer(ChannelFrameworkFactory.getBufferManager().allocate(getJITAllocateSize()));
              }
              setJITAllocateAction(true);
          }
  
          // set context read parameters
          setIOAmount(numBytes);
          setLastIOAmt(0);
          setIODoneAmount(0);
          setTimeoutTime(timeout);
  
          try {
              bytesRead = ((AioSocketIOChannel) getTCPConnLink().getSocketIOChannel()).readAIOSync(numBytes, this);
  
              if (numBytes == 0 && bytesRead == 0) {
                  freeJIT = true;
              }
  
          } catch (AsyncTimeoutException ate) {
              exThisTime = new SocketTimeoutException(ate.getMessage());
              exThisTime.initCause(ate);
              freeJIT = true;
  
          } catch (IOException ioe) {
              exThisTime = ioe;
              freeJIT = true;
  
          }
  
          if (freeJIT && getJITAllocateAction()) {
              getBuffer().release();
              setBuffer(null);
              setJITAllocateAction(false);
          }
  
          if (exThisTime != null) {
              throw exThisTime;
          }
  
          return bytesRead;
  
      }
docs: that apply here