method random_connected_port = (* This does not terminate if there are no connected ports! *)
(*     let port = (Random.int ports) + 1 in *)
    let port = (Random.int ports) in (* 0-based numbering *)
      if self#is_connected port then
        port
      else
        self#random_connected_port