Working on tests for small changes in ipv4/6
This commit is contained in:
parent
85efa25f0a
commit
6b5d9ff698
@ -6,6 +6,7 @@ import dorkbox.network.Server
|
||||
import dorkbox.network.connection.Connection
|
||||
import kotlinx.atomicfu.atomic
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
@ -26,7 +27,9 @@ class MultiClientTest : BaseTest() {
|
||||
// clients first, so they try to connect to the server at (roughly) the same time
|
||||
val clients = mutableListOf<Client<Connection>>()
|
||||
for (i in 1..totalCount) {
|
||||
val client: Client<Connection> = Client(clientConfig(), "Client$i")
|
||||
val config = clientConfig()
|
||||
config.enableIPv6 = false
|
||||
val client: Client<Connection> = Client(config, "Client$i")
|
||||
client.onConnect {
|
||||
clientConnectCount.getAndIncrement()
|
||||
logger.error("${this.id} - Connected $i!")
|
||||
@ -48,6 +51,7 @@ class MultiClientTest : BaseTest() {
|
||||
|
||||
|
||||
val configuration = serverConfig()
|
||||
configuration.enableIPv6 = false
|
||||
|
||||
val server: Server<Connection> = Server(configuration)
|
||||
addEndPoint(server)
|
||||
@ -59,19 +63,14 @@ class MultiClientTest : BaseTest() {
|
||||
|
||||
if (count == totalCount) {
|
||||
logger.error { "Stopping endpoints!" }
|
||||
delay(6000)
|
||||
outputStats(server)
|
||||
|
||||
delay(2000)
|
||||
outputStats(server)
|
||||
|
||||
val dateFormat = SimpleDateFormat("HH:mm:ss")
|
||||
print(dateFormat.format(Date()))
|
||||
println("======================================================================")
|
||||
server.driverCounters { counterId, counterValue, typeId, keyBuffer, label ->
|
||||
//if (counterFilter.filter(typeId, keyBuffer)) {
|
||||
System.out.format("%3d: %,20d - %s%n", counterId, counterValue, label)
|
||||
//}
|
||||
}
|
||||
|
||||
println(server.driverBacklog().output())
|
||||
|
||||
delay(2000)
|
||||
outputStats(server)
|
||||
|
||||
stopEndPoints(10000L)
|
||||
}
|
||||
@ -85,4 +84,17 @@ class MultiClientTest : BaseTest() {
|
||||
Assert.assertEquals(totalCount, serverConnectCount.value)
|
||||
Assert.assertEquals(totalCount, disconnectCount.value)
|
||||
}
|
||||
|
||||
suspend fun outputStats(server: Server<Connection>) {
|
||||
val dateFormat = SimpleDateFormat("HH:mm:ss")
|
||||
print(dateFormat.format(Date()))
|
||||
println("======================================================================")
|
||||
server.driverCounters { counterId, counterValue, typeId, keyBuffer, label ->
|
||||
//if (counterFilter.filter(typeId, keyBuffer)) {
|
||||
System.out.format("%3d: %,20d - %s%n", counterId, counterValue, label)
|
||||
//}
|
||||
}
|
||||
|
||||
println(server.driverBacklog().output())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user