Changed loopback -> localhost (loopback is invalid on macos)

This commit is contained in:
Robinson 2022-03-15 12:44:52 +01:00
parent 9f350fa767
commit 29f71f425f
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
14 changed files with 47 additions and 50 deletions

View File

@ -58,9 +58,7 @@ import org.slf4j.LoggerFactory
import java.lang.Thread.sleep import java.lang.Thread.sleep
import java.lang.reflect.Field import java.lang.reflect.Field
import java.lang.reflect.Method import java.lang.reflect.Method
import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.*
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
abstract class BaseTest { abstract class BaseTest {
@Volatile @Volatile
@ -70,7 +68,7 @@ abstract class BaseTest {
private var autoFailThread: Thread? = null private var autoFailThread: Thread? = null
companion object { companion object {
const val LOOPBACK = "loopback" const val LOCALHOST = "localhost"
fun clientConfig(block: Configuration.() -> Unit = {}): Configuration { fun clientConfig(block: Configuration.() -> Unit = {}): Configuration {
val configuration = Configuration() val configuration = Configuration()

View File

@ -45,7 +45,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -94,7 +94,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -142,7 +142,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -191,7 +191,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -232,7 +232,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
stopEndPoints() stopEndPoints()
@ -281,7 +281,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
stopEndPoints() stopEndPoints()
@ -321,7 +321,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -367,7 +367,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -419,7 +419,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -462,7 +462,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e
@ -500,7 +500,7 @@ class ConnectionFilterTest : BaseTest() {
} }
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: Exception) { } catch (e: Exception) {
stopEndPoints() stopEndPoints()
throw e throw e

View File

@ -49,14 +49,14 @@ class DisconnectReconnectTest : BaseTest() {
else { else {
logger.error("Reconnecting: $count") logger.error("Reconnecting: $count")
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
@ -105,14 +105,14 @@ class DisconnectReconnectTest : BaseTest() {
else { else {
logger.error("Reconnecting: $count") logger.error("Reconnecting: $count")
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
@ -183,14 +183,14 @@ class DisconnectReconnectTest : BaseTest() {
else { else {
logger.error("Reconnecting: $count") logger.error("Reconnecting: $count")
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
@ -239,14 +239,14 @@ class DisconnectReconnectTest : BaseTest() {
else { else {
logger.error("Reconnecting: $count") logger.error("Reconnecting: $count")
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
@ -296,14 +296,14 @@ class DisconnectReconnectTest : BaseTest() {
else { else {
logger.error("Reconnecting: $count") logger.error("Reconnecting: $count")
try { try {
client.connect(LOOPBACK) client.connect(LOCALHOST)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
@ -347,7 +347,7 @@ class DisconnectReconnectTest : BaseTest() {
stopEndPoints() stopEndPoints()
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
server.close() server.close()

View File

@ -71,7 +71,7 @@ class ErrorLoggerTest : BaseTest() {
stopEndPoints() stopEndPoints()
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -151,7 +151,7 @@ class ListenerTest : BaseTest() {
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
waitForThreads() waitForThreads()

View File

@ -43,8 +43,7 @@ import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.*
import java.util.concurrent.atomic.AtomicInteger
class MultipleServerTest : BaseTest() { class MultipleServerTest : BaseTest() {
val total = 5 val total = 5
@ -113,7 +112,7 @@ class MultipleServerTest : BaseTest() {
send("client_$count") send("client_$count")
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
@ -188,7 +187,7 @@ class MultipleServerTest : BaseTest() {
send("client_$count") send("client_$count")
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -40,7 +40,7 @@ import dorkbox.network.connection.Connection
import dorkbox.network.serialization.Serialization import dorkbox.network.serialization.Serialization
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.*
class PingPongTest : BaseTest() { class PingPongTest : BaseTest() {
@Volatile @Volatile
@ -108,7 +108,7 @@ class PingPongTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }

View File

@ -49,7 +49,7 @@ class PingTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
@ -106,7 +106,7 @@ class PingTest : BaseTest() {
send(ping) send(ping)
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -50,7 +50,7 @@ class SerializationValidationTest : BaseTest() {
send(FinishedCommand()) send(FinishedCommand())
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
@ -112,7 +112,7 @@ class SerializationValidationTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
@ -158,7 +158,7 @@ class SerializationValidationTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -42,7 +42,7 @@ class StorageTest : BaseTest() {
} }
val client = Client<Connection>(config) val client = Client<Connection>(config)
client.connect(LOOPBACK) client.connect(LOCALHOST)
Assert.assertTrue(server.storage.getSalt().contentEquals(client.storage.getSalt())) Assert.assertTrue(server.storage.getSalt().contentEquals(client.storage.getSalt()))

View File

@ -23,7 +23,7 @@ import dorkbox.network.serialization.Serialization
import dorkboxTest.network.BaseTest import dorkboxTest.network.BaseTest
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.junit.Test import org.junit.Test
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.*
class RmiDelayedInvocationTest : BaseTest() { class RmiDelayedInvocationTest : BaseTest() {
private val iterateLock = Any() private val iterateLock = Any()
@ -104,7 +104,7 @@ class RmiDelayedInvocationTest : BaseTest() {
stopEndPoints() stopEndPoints()
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -21,7 +21,7 @@ import dorkbox.network.connection.Connection
import dorkboxTest.network.BaseTest import dorkboxTest.network.BaseTest
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.*
@ -116,7 +116,7 @@ class RmiNestedTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
} }
@ -181,7 +181,7 @@ class RmiNestedTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
} }
@ -240,7 +240,7 @@ class RmiNestedTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
} }
@ -300,7 +300,7 @@ class RmiNestedTest : BaseTest() {
} }
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()
} }

View File

@ -24,7 +24,7 @@ import dorkbox.network.rmi.RemoteObject
import dorkboxTest.network.BaseTest import dorkboxTest.network.BaseTest
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.*
class RmiSpamAsyncTest : BaseTest() { class RmiSpamAsyncTest : BaseTest() {
private val counter = AtomicLong(0) private val counter = AtomicLong(0)
@ -112,7 +112,7 @@ class RmiSpamAsyncTest : BaseTest() {
stopEndPoints() stopEndPoints()
} }
client.connect(LOOPBACK) client.connect(LOCALHOST)
} }
waitForThreads() waitForThreads()

View File

@ -102,7 +102,7 @@ object TestClient {
close() close()
} }
client.connect(BaseTest.LOOPBACK) client.connect(BaseTest.LOCALHOST)
runBlocking { runBlocking {
client.waitForClose() client.waitForClose()