Created
May 22, 2015 22:47
-
-
Save mhshams/f5d97738b4104c3c0109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val vertx = Vertx.vertx() | |
vertx.createHttpServer().requestHandler { request -> | |
request.response().end("Hello World!") | |
}.listen(8080) { result -> | |
if (result.succeeded()) { | |
vertx.createHttpClient().getNow(8080, "localhost", "/") { response -> | |
response.bodyHandler { body -> println("Server Response: ${body.toString()}") } | |
} | |
} else { | |
println("Failed to start server: ${result.cause()}") | |
} | |
} | |
Thread.sleep(500L) | |
vertx.close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment