Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@

package org.apache.pekko.testkit

import java.net.{ DatagramSocket, InetSocketAddress, NetworkInterface, StandardProtocolFamily }
import java.net.{ DatagramSocket, InetSocketAddress, NetworkInterface, StandardProtocolFamily, StandardSocketOptions }
import java.nio.channels.DatagramChannel
import java.nio.channels.ServerSocketChannel

import scala.collection.immutable
import scala.util.Random
import scala.util.control.NonFatal
Expand Down Expand Up @@ -104,7 +103,10 @@ object SocketUtil {
ds.bind(addr)
(ds, new InetSocketAddress(address, ds.getLocalPort))
} else {
val ss = ServerSocketChannel.open().socket()
val serverSocketChannel = ServerSocketChannel.open
serverSocketChannel.setOption(StandardSocketOptions.SO_REUSEADDR, java.lang.Boolean.TRUE)
serverSocketChannel.setOption(StandardSocketOptions.SO_REUSEPORT, java.lang.Boolean.TRUE)
val ss = serverSocketChannel.socket()
ss.bind(addr)
(ss, new InetSocketAddress(address, ss.getLocalPort))
}
Expand Down