def allocate_port(max_attempts = 10)
      attempts = 0
      until @port
        attempts += 1
        possible_port = rand(10000) + 20000
        if self.port_available?(possible_port)
          Procodile.log(@process.log_color, description, "Allocated port as #{possible_port}")
          return @port = possible_port
        elsif attempts >= max_attempts
          raise Procodile::Error, "Couldn't allocate port for #{instance.name}"
        end
      end
    end
def allocate_port(max_attempts = 10)
      attempts = 0
      until @port
        attempts += 1
        possible_port = rand(10000) + 20000
        if self.port_available?(possible_port)
          Procodile.log(@process.log_color, description, "Allocated port as #{possible_port}")
          return @port = possible_port
        elsif attempts >= max_attempts
          raise Procodile::Error, "Couldn't allocate port for #{instance.name}"
        end
      end
    end
Find a port number for this instance to listen on. We just check that nothing is already listening on it.
 The process is expected to take it straight away if it wants it.