Skip to content

Instantly share code, notes, and snippets.

@mhshams
Created May 22, 2015 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhshams/f5d97738b4104c3c0109 to your computer and use it in GitHub Desktop.
Save mhshams/f5d97738b4104c3c0109 to your computer and use it in GitHub Desktop.
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