You can add a `@tailrec` annotation here since this method is tail-recursive. So it would be:

```scala
  import scala.annotation.tailrec

  @tailrec
  def findFreePort(startingPort: Int): Int = { ... }
```