cleaned up logs
This commit is contained in:
parent
01d818fa6e
commit
9478acc0f4
@ -9,10 +9,8 @@ import kotlinx.coroutines.runBlocking
|
|||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class DisconnectReconnectTest : BaseTest() {
|
class DisconnectReconnectTest : BaseTest() {
|
||||||
private val timer = Timer()
|
|
||||||
private val reconnectCount = atomic(0)
|
private val reconnectCount = atomic(0)
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -27,10 +25,10 @@ class DisconnectReconnectTest : BaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server.onConnect { connection ->
|
server.onConnect { connection ->
|
||||||
println("Disconnecting after 2 seconds.")
|
connection.logger.error("Disconnecting after 2 seconds.")
|
||||||
delay(2000)
|
delay(2000)
|
||||||
|
|
||||||
println("Disconnecting....")
|
connection.logger.error("Disconnecting....")
|
||||||
connection.close()
|
connection.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,14 +41,15 @@ class DisconnectReconnectTest : BaseTest() {
|
|||||||
|
|
||||||
|
|
||||||
client.onDisconnect { connection ->
|
client.onDisconnect { connection ->
|
||||||
println("Disconnected!")
|
connection.logger.error("Disconnected!")
|
||||||
|
|
||||||
val count = reconnectCount.getAndIncrement()
|
val count = reconnectCount.getAndIncrement()
|
||||||
if (count == 3) {
|
if (count == 3) {
|
||||||
println("Shutting down")
|
connection.logger.error("Shutting down")
|
||||||
stopEndPoints()
|
stopEndPoints()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println("Reconnecting: $count")
|
connection.logger.error("Reconnecting: $count")
|
||||||
try {
|
try {
|
||||||
client.connect(LOOPBACK)
|
client.connect(LOOPBACK)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
|
Loading…
Reference in New Issue
Block a user