All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.landoop.kafka.testing.PortProvider.scala Maven / Gradle / Ivy

The newest version!
package com.landoop.kafka.testing

import java.net.{InetAddress, ServerSocket}

object PortProvider {
  def appy(count: Int): Vector[Int] = {
    (1 to count).map { _ =>
      val serverSocket = new ServerSocket(0, 0, InetAddress.getLocalHost)
      val port = serverSocket.getLocalPort
      serverSocket.close()
      port
    }.toVector
  }

  def one: Int = appy(1).head
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy