fun <T> use(username: String, password: String, block: CordaRPCOps.() -> T): T
A convenience function that opens a connection with the given credentials, executes the given code block with all available RPCs in scope and shuts down the RPC connection again. It's meant for quick prototyping and demos. For more control you probably want to control the lifecycle of the client and proxies independently, as well as configuring a timeout and other such features via the proxy method.
After this method returns the client is closed and can't be restarted.