docs: protected IOResult attemptWriteToSocket(TCPBaseRequestContext req) throws IOException {
          IOResult rc = IOResult.NOT_COMPLETE;
  
          WsByteBuffer wsBuffArray[] = req.getBuffers();
  
          long bytesWritten = attemptWriteToSocketUsingNIO(req, wsBuffArray);
  
          req.setLastIOAmt(bytesWritten);
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
              Tr.event(this, tc, "Wrote " + bytesWritten + " bytes, " + req.getIOAmount() + " requested on local: " + getSocket().getLocalSocketAddress() + " remote: "
                                 + getSocket().getRemoteSocketAddress());
          }
  
          // when request came from selector, it should always write at least 1 byte
          // if it does write 0 (saw this 1 time), just let it retry
  
          if (bytesWritten < 0) {
              // invalid value returned for number of bytes written
              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled() && !req.getTCPConnLink().getConfig().isInbound()) {
                  Tr.event(this, tc, "invalid value returned for bytes written");
              }
              return IOResult.FAILED;
          }
  
          // Determine if we should consider this operation
          // complete or not.
          if (req.getIOAmount() == TCPWriteRequestContext.WRITE_ALL_DATA) {
              ByteBuffer[] buffers = req.getByteBufferArray();
              rc = IOResult.COMPLETE;
              for (int i = 0; i < buffers.length; i++) {
                  if (buffers[i].hasRemaining()) {
                      rc = IOResult.NOT_COMPLETE;
                      break; // out of loop
                  }
              }
  
              req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
  
          } else {
              req.setIODoneAmount(req.getIODoneAmount() + bytesWritten);
              if (req.getIODoneAmount() >= req.getIOAmount()) {
                  rc = IOResult.COMPLETE;
              }
          }
  
          if (rc == IOResult.COMPLETE) {
              req.setIOCompleteAmount(req.getIODoneAmount());
              req.setIODoneAmount(0);
          }
          return rc;
      }