def METHOD_NAME(jp_unix_socket_file):
    url = urlencode_unix_socket(jp_unix_socket_file).encode()
    encoded_sock_path = urlencode_unix_socket_path(jp_unix_socket_file)
    p = subprocess.Popen(
        ["jupyter-server", "--sock=%s" % jp_unix_socket_file, "--sock-mode=0700"],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
    )
    complete = False
    assert p.stderr is not None
    for line in iter(p.stderr.readline, b""):
        if url in line:
            complete = True
            break
    assert complete, "did not find socket URL in stdout when launching notebook"
    assert encoded_sock_path in _check_output("jupyter-server list")
    # Ensure umask is properly applied.
    assert stat.S_IMODE(os.lstat(jp_unix_socket_file).st_mode) == 0o700
    try:
        _check_output("jupyter-server stop")
    except subprocess.CalledProcessError as e:
        assert "There is currently no server running on" in e.output.decode()
    else:
        raise AssertionError("expected stop command to fail due to target mis-match")
    assert encoded_sock_path in _check_output("jupyter-server list")
    # Fake out stopping the server.
    app = JupyterServerStopApp(sock=str(jp_unix_socket_file))
    app.initialize([])
    app.shutdown_server = lambda _: True  # type:ignore
    app._maybe_remove_unix_socket = lambda _: _  # type: ignore
    app.start()
    _check_output(["jupyter-server", "stop", jp_unix_socket_file])
    assert encoded_sock_path not in _check_output(["jupyter-server", "list"])
    _cleanup_process(p)