Skip to content

Commit

Permalink
Use another port for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Mar 18, 2018
1 parent 59cb22e commit 21aca95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -5,13 +5,13 @@ import net.zomis.core.events.EventSystem
import net.zomis.games.server2.ws.Server2WS
import java.net.InetSocketAddress

class Server2 {
class Server2(val port: Int) {
private val logger = KLoggers.logger(this)
private val events = EventSystem()

fun start(args: Array<String>) {
events.addListener(StartupEvent::class, {
val ws = Server2WS(events, InetSocketAddress(8081)).setup()
val ws = Server2WS(events, InetSocketAddress(port)).setup()
logger.info("WebSocket server listening at ${ws.port}")
})

Expand All @@ -23,9 +23,10 @@ class Server2 {
}

}

object Main {
@JvmStatic
fun main(args: Array<String>) {
Server2().start(args)
Server2(8081).start(args)
}
}
Expand Up @@ -15,7 +15,7 @@ class ClientTest {

@BeforeEach
fun startServer() {
server = Server2()
server = Server2(8378)
server!!.start(arrayOf())
}

Expand All @@ -26,7 +26,7 @@ class ClientTest {

@Test
fun conn() {
val client = WSClient(URI("ws://127.0.0.1:8081"))
val client = WSClient(URI("ws://127.0.0.1:8378"))
client.connectBlocking()
client.send("PING")
Thread.sleep(1000)
Expand Down

0 comments on commit 21aca95

Please sign in to comment.