fix(server): use a random port when port is 0 (#23158)