code: func (c *Client) autoPortListenWorkaround(laddr *net.TCPAddr) (net.Listener, error) {
  	var sshListener net.Listener
  	var err error
  	const tries = 10
  	for i := 0; i < tries; i++ {
  		addr := *laddr
  		addr.Port = 1024 + portRandomizer.Intn(60000)
  		sshListener, err = c.ListenTCP(&addr)
  		if err == nil {
  			laddr.Port = addr.Port
  			return sshListener, err
  		}
  	}
  	return nil, fmt.Errorf("ssh: listen on random port failed after %d tries: %v", tries, err)
  }
docs: // autoPortListenWorkaround simulates automatic port allocation by
  // trying random ports repeatedly.