File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/main/kotlin/com/redhat/devtools/gateway/openshift Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import java.io.IOException
38
38
import java.io.InputStream
39
39
import java.io.OutputStream
40
40
import java.net.InetAddress
41
+ import java.net.InetSocketAddress
41
42
import java.net.ServerSocket
42
43
import java.net.Socket
43
44
import java.util.concurrent.TimeUnit
@@ -99,7 +100,10 @@ class Pods(private val client: ApiClient) {
99
100
// https://github.com/kubernetes-client/java/blob/master/examples/examples-release-latest/src/main/java/io/kubernetes/client/examples/PortForwardExample.java
100
101
@Throws(IOException ::class )
101
102
fun forward (pod : V1Pod , localPort : Int , remotePort : Int ): Closeable {
102
- val serverSocket = ServerSocket (localPort, 50 , InetAddress .getLoopbackAddress())
103
+ val serverSocket = ServerSocket ()
104
+ serverSocket.use {
105
+ it.bind(InetSocketAddress (InetAddress .getLoopbackAddress(), localPort))
106
+ }
103
107
104
108
val scope = CoroutineScope (Dispatchers .IO )
105
109
scope.launch {
You can’t perform that action at this time.
0 commit comments