mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[rdct-tests] introduce a port provider that makes sure the random port is requested from different diapasons
that is useful when several ports are requested in one test before they are actually used GitOrigin-RevId: 0481897e66caec455aa932cff182d4a3afced49d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0273a7bcdb
commit
272ead5603
@@ -9,8 +9,6 @@ import com.intellij.tools.launch.os.ProcessOutputStrategy
|
||||
import kotlinx.coroutines.CoroutineName
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import org.jetbrains.jps.model.java.JpsJavaClasspathKind
|
||||
import java.net.InetAddress
|
||||
import java.net.ServerSocket
|
||||
|
||||
object Launcher {
|
||||
@Suppress("SSBasedInspection")
|
||||
@@ -62,14 +60,4 @@ object Launcher {
|
||||
return IdeLauncher.launchCommand(localLauncherFactory, ideLaunchContext).process to null
|
||||
}
|
||||
}
|
||||
|
||||
fun findFreePort(): Int {
|
||||
synchronized(this) {
|
||||
val socket = ServerSocket(0, 0, InetAddress.getByName("127.0.0.1"))
|
||||
val result = socket.localPort
|
||||
socket.reuseAddress = true
|
||||
socket.close()
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user