docs: private static void flushCloseDown(SSLEngine engine, WsByteBuffer outputBuffer, SSLConnectionLink xConnLink) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "flushCloseDown");
          }
  
          TCPWriteRequestContext deviceWriteInterface = xConnLink.getDeviceWriteInterface();
  
          int configuredTimeoutValue = xConnLink.getChannel().getTimeoutValueInSSLClosingHandshake();
          long timeoutTimestamp = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(configuredTimeoutValue);
  
          try {
              Status status = null;
              do {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                      Tr.event(tc, "before wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer));
                  }
                  // Note: there is no fear of the netBuffers being too big for JSSE.
                  // Allow SSL engine to flush out close down information to the caller.
                  SSLEngineResult result = engine.wrap(emptyBuffer, outputBuffer.getWrappedByteBuffer());
                  int amountToWrite = result.bytesProduced();
                  long amountWritten = 0;
                  if (0 < amountToWrite) {
                      outputBuffer.flip();
                  }
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                      Tr.event(tc, "after wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer)
                                   + "\r\n\tstatus=" + result.getStatus()
                                   + " consumed=" + result.bytesConsumed()
                                   + " produced=" + result.bytesProduced());
                  }
                  if (0 < amountToWrite) {
                      // Inform the device side of the new buffer to write.
                      deviceWriteInterface.setBuffer(outputBuffer);
  
                      while (amountWritten < amountToWrite) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                              Tr.event(tc, "want to write bytes: " + amountToWrite);
                          }
  
                          // Write the buffer to the device side channel.  need to return immediately so we don't hang this write.
                          // Update the amount of bytes that have been written out in our internal instance.
                          amountWritten += deviceWriteInterface.write(0, TCPRequestContext.USE_CHANNEL_TIMEOUT);
  
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                              Tr.event(tc, "bytes written: " + amountWritten);
                          }
  
                          if (xConnLink.getChannel().getstop0Called()) {
                              // don't hold up stopping the channel for this write handshake to complete, since it may never complete.
                              break;
                          }
  
                          if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) {
                              // don't hold up stopping the channel if the custom property is not set to indefinite and the
                              // designated timeout point has been reached.
                              break;
                          }
  
                          else if (configuredTimeoutValue > -1 && amountWritten == 0) {
                              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                                  Tr.event(tc, "Did not write anything, sleeping thread before trying again.");
                              }
                              try {
                                  Thread.sleep(1000);
                              } catch (InterruptedException e) {
                                  // do nothing - continue trying to write until counter reaches the defined amount.
                              }
  
                          }
  
                          else if (amountWritten == 0) {
                              // if we didn't write anything, don't hard loop, but let other threads run before trying again.
                              Thread.yield();
                          }
  
                      }
  
                      // after the sync write, clear the buffer in case there was a
                      // buffer overflow condition we need to account for, and therefore
                      // another write will be need.
                      outputBuffer.clear();
                  }
                  // Extract the status to see if more must be written.
                  status = result.getStatus();
                  if ((Status.OK == status && 0 == amountToWrite) || xConnLink.getChannel().getstop0Called()) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "Did not produce anything, quit now");
                          Tr.debug(tc, "status: " + status + " amountToWrite: " + amountToWrite
                                       + " amountWritten: " + amountWritten + " stop0Called: " + xConnLink.getChannel().getstop0Called());
                      }
                      break; // out of while
                  } else if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "Closing handshake write timeout amount in SSL Channel met. Quit now.");
                      }
                      break; //out of while
                  }
              } while (status != Status.CLOSED);
          } catch (Exception e) {
              // No FFDC needed.
              // Exception from doing write. Nothing more can be done.
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Exception caught closing down, " + e);
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "flushCloseDown");
          }
      }