code: public final void execute () throws InternetSCSIException {
  
          ProtocolDataUnit protocolDataUnit;
  
          do {
              protocolDataUnit = connection.receive();
              boolean dataWasRead = false;
              if (protocolDataUnit.getBasicHeaderSegment().getParser() instanceof DataInParser) {
                  final DataInParser parser = (DataInParser) protocolDataUnit.getBasicHeaderSegment().getParser();
  
                  if (LOGGER.isDebugEnabled()) {
                      LOGGER.debug("Remaining, DataSegmentLength: " + buffer.remaining() + ", " + protocolDataUnit.getBasicHeaderSegment().getDataSegmentLength());
                  }
  
                  final ByteBuffer dataSegment = protocolDataUnit.getDataSegment();
                  while (buffer.hasRemaining() && dataSegment.hasRemaining()) {
                      buffer.put(dataSegment.get());
                  }
                  dataWasRead = true;
                  // last message with the status flag set
                  if (parser.isStatusFlag() && parser.getStatus() == SCSIStatus.GOOD) {
                      // return false;
                      return;
                  } else if (connection.getSettingAsInt(OperationalTextKey.ERROR_RECOVERY_LEVEL) > 0 && parser.isAcknowledgeFlag()) {
                      // TODO: Test this case
                      // send a DataAck
                      connection.nextState(new SNACKRequestState(connection, this, parser.getTargetTaskTag()));
                      // return true;
                      return;
                  } else if (protocolDataUnit.getBasicHeaderSegment().getParser() instanceof SCSIResponseParser && !dataWasRead) {
                      readHandleImmediateData(protocolDataUnit);
                  }
              }
          } while (!protocolDataUnit.getBasicHeaderSegment().isFinalFlag());
  
          if (connection.getSettingAsBoolean(OperationalTextKey.IMMEDIATE_DATA)) {
              return;
          } else {
              protocolDataUnit = connection.receive();
              if (protocolDataUnit.getBasicHeaderSegment().getParser() instanceof SCSIResponseParser) {
                  readHandleImmediateData(protocolDataUnit);
              }
          }
  
      }
docs: {@inheritDoc}