在Corda中创建用于测试流的模拟网络时,如何获得与其中一个模拟节点的RPC连接?
答案 0 :(得分:1)
模拟节点未公开用于获取RPC连接的API。
如果需要运行涉及节点RPC连接的测试,则应通过节点驱动程序启动节点:
fun main(args: Array<String>) {
val user = User("user1", "test", permissions = setOf("ALL"))
driver(DriverParameters(startNodesInProcess = true, waitForAllNodesToFinish = true)) {
val partyA = startNode(providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = listOf(user)).getOrThrow()
val cordaRPCOps = partyA.rpc
TODO("Tests using the RPC connection.")
}
}