Skip to content

Instantly share code, notes, and snippets.

@javajosh
Created April 7, 2013 19:47
Show Gist options
  • Save javajosh/5332187 to your computer and use it in GitHub Desktop.
Save javajosh/5332187 to your computer and use it in GitHub Desktop.
Demonstrate a bug in either vertx or the documentation
//invoke with VERTX_OPTS="" vertx run vertx-bug.groovy
def client = vertx.createNetClient();
//The docs appear to be wrong. TODO file bug with vertx http://vertx.io/core_manual_groovy.html#catching-exceptions-on-the-net-client
//Caused by: groovy.lang.MissingMethodException: No signature of method: org.vertx.groovy.core.net.impl.DefaultNetClient.exceptionHandler() is applicable for argument types: (vertx-bug$_run_closure1) values: [vertx-bug$_run_closure1@32d16fe3]
client.exceptionHandler { ex -> println "Failed to connect $ex"; container.exit() }
client.connect(1234, "localhost") { socket ->
socket.dataHandler { buffer ->
println "client recieved: ${buffer}"
container.exit()
}
def str = "hello"
print "client sending $str"
socket << str << "\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment