File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
kotlinx-coroutines-nio/src/test/kotlin/kotlinx/coroutines/experimental/nio Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,13 @@ import java.nio.channels.AsynchronousFileChannel
1111import java.nio.channels.AsynchronousServerSocketChannel
1212import java.nio.channels.AsynchronousSocketChannel
1313import java.nio.file.StandardOpenOption
14+ import java.util.*
1415import kotlin.test.assertEquals
1516import kotlin.test.assertTrue
1617
1718class AsyncIOTest {
19+ val PORT = Random ().nextInt(10000 ) + 10000 // randomize port for this test
20+
1821 @Rule
1922 @JvmField
2023 val tmpDir = TemporaryFolder ()
@@ -63,7 +66,7 @@ class AsyncIOTest {
6366 val serverChannel =
6467 AsynchronousServerSocketChannel
6568 .open()
66- .bind(InetSocketAddress (8080 ))
69+ .bind(InetSocketAddress (PORT ))
6770
6871 val c1 = launch(CommonPool ) {
6972 val client = serverChannel.aAccept()
@@ -80,7 +83,7 @@ class AsyncIOTest {
8083 val connection =
8184 AsynchronousSocketChannel .open()
8285 // async calls
83- connection.aConnect(InetSocketAddress (" 127.0.0.1" , 8080 ))
86+ connection.aConnect(InetSocketAddress (" 127.0.0.1" , PORT ))
8487 connection.aWrite(Charsets .UTF_8 .encode(" OK" ))
8588
8689 val buffer = ByteBuffer .allocate(3 )
You can’t perform that action at this time.
0 commit comments