summaryrefslogtreecommitdiff
path: root/src/main/kotlin/Main.kt
blob: 7f19f9064062edb4c4f5deaa3517a54e13463a70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import kotlinx.coroutines.runBlocking
import kotlin.system.exitProcess

object Main {

    @JvmStatic
    fun main(args: Array<String>) {
        if (args.size != 1) {
            System.err.println("Use ./javamailteste run")
            exitProcess(1)
        }
        when (args[0]) {
            "run" -> runServer(args.getOrElse(1) { "2500" }.toInt())
        }
    }

    fun runServer(port: Int) {
        val mailServer = MailServer("nea89.moe")
        runBlocking { mailServer.createServer(port) }
    }
}