Integers are big-endian. ·· is just a byte-boundary marker, not an actual byte.
# Immediate acquire (wait=5s, lease=30s), key="order-1234"
client → 'A' 00·05 00·1E "order-1234" \n
server → 'A' 00·00·00·00·00·00·00·01 "order-1234" \n (token 1)
# Waiting while held (a different connection, wait=1s)
client2 → 'A' 00·01 00·1E "order-1234" \n
... pending ...
# (a) if the holder releases, it's handed off immediately
client → 'R' "order-1234" \n
server → 'R' "order-1234" \n (client: released)
server → 'A' 00·00·00·00·00·00·00·02 "order-1234" \n (client2: handed off, larger token)
# (b) if not received within wait(1s)
server → 'T' "order-1234" \n (client2: timeout — no grant)
# Releasing a nonexistent key / invalid request
client → 'R' "ghost" \n → server 'N' "ghost" \n
client → 'Z' ... → server 'E' "bad_op" \nSince it's binary, you can also check it quickly with nc.
# acquire: key=order-1, wait=5s(00 05), lease=30s(00 1e)
printf 'A\x00\x05\x00\x1eorder-1\n' | nc -w1 127.0.0.1 5225 | xxd
# → 41 0000000000000001 6f72646572... ('A' + token=1 + "order-1")
printf 'Rorder-1\n' | nc -w1 127.0.0.1 5225 | xxd # → 52 ... ('R' + "order-1")
printf 'Zx\n' | nc -w1 127.0.0.1 5225 # → Ebad_opThe server-to-server cluster replication protocol is covered in Protocol (Cluster).