private @Nullable CliResult tryListen() throws IOException, CannotActivateException {
    var serverChannel = ServerSocketChannel.open(myFallbackMode ? StandardProtocolFamily.INET : StandardProtocolFamily.UNIX);

    SocketAddress address;
    if (myFallbackMode) {
      Files.writeString(myPortFile, "0", StandardOpenOption.CREATE_NEW);
      address = new InetSocketAddress(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}), 0);
    }
    else if (myRedirectedPortFile != null) {
      Files.writeString(myPortFile, myRedirectedPortFile.toString(), StandardOpenOption.CREATE_NEW);
      address = UnixDomainSocketAddress.of(myRedirectedPortFile);
    }
    else {
      address = UnixDomainSocketAddress.of(myPortFile);
    }

    if (LOG.isDebugEnabled()) LOG.debug("binding to " + address);
    serverChannel.bind(address);
    myServerChannel = serverChannel;

    try {
      if (myFallbackMode) {
        var port = ((InetSocketAddress)serverChannel.getLocalAddress()).getPort();
        Files.writeString(myPortFile, String.valueOf(port), StandardOpenOption.TRUNCATE_EXISTING);
      }
      lockDirectory(myLockFile);
    }
    catch (Exception e) {
      LOG.debug(e);
      dispose(false);
      throw new CannotActivateException(e);
    }

    new Thread(this::acceptConnections, SERVER_THREAD_NAME).start();
    return null;
  }
private @Nullable CliResult tryListen()