docs: private void init(int port, File commandFileTmp) throws IOException {
          if (port != -1) {
              serverSocketChannel = SelectorProvider.provider().openServerSocketChannel();
  
              // Open the socket for loopback only..
              InetSocketAddress address = new InetSocketAddress(InetAddress.getByName(null), port);
  
              IOException bindError = null;
  
              boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
  
              try {
                  //Attempt bind with reuseAddress set to false.
                  serverSocketChannel.socket().setReuseAddress(false);
                  serverSocketChannel.socket().bind(address);
  
                  //If we are not on Windows and the bind succeeded, we should set reuseAddr=true
                  //for future binds.
                  if (!isWindows) {
                      serverSocketChannel.socket().setReuseAddress(true);
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "ServerSocket reuse set to true to allow for later override");
                      }
                  }
              } catch (IOException ioe) {
                  // see if we got the error because port is in waiting to be cleaned up.
                  // If so, no one should be accepting connections on it, and open should fail.
                  // If that's the case, we can set ReuseAddr to expedite the bind process.
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "ServerSocket bind failed on first attempt with IOException: " + ioe.getMessage());
                  }
                  bindError = ioe;
                  try {
                      InetSocketAddress testAddr = new InetSocketAddress(InetAddress.getByName(null), port);
                      if (!testAddr.isUnresolved()) {
                          SocketChannel testChannel = SocketChannel.open(testAddr);
                          // if we get here, socket opened successfully, which means someone is really listening
                          // so close connection and don't bother trying to bind again
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "attempt to connect to command port to check listen status worked, someone else is using the port!");
                          }
                          testChannel.close();
                      } else {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "Test connection addr is unresolvable; " + testAddr);
                          }
                      }
                  } catch (IOException testioe) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "attempt to connect to command port to check listen status failed with IOException: " + testioe.getMessage());
                      }
                      try {
                          // open (or close) got IOException, retry with reuseAddress set to true
                          serverSocketChannel.socket().setReuseAddress(true);
                          serverSocketChannel.socket().bind(address);
                          bindError = null;
  
                      } catch (IOException newioe) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "ServerSocket bind failed on second attempt with IOException: " + newioe.getMessage());
                          }
                          bindError = newioe;
                      }
                  }
              }
  
              if (bindError == null) {
                  // if we requested an ephemeral port, find out what port we ended up with
                  if (port == 0) {
                      port = serverSocketChannel.socket().getLocalPort();
                  }
                  listenForCommands = true;
              } else {
                  throw bindError;
              }
          }
  
          ServerCommandID sci = new ServerCommandID(port, serverUUID);
  
          FileOutputStream fos = null;
          try {
              fos = new FileOutputStream(commandFileTmp);
              fos.write(sci.getIDString().getBytes());
              fos.close();
          } finally {
              Utils.tryToClose(fos);
          }
      }