mirror of
https://github.com/corda/corda.git
synced 2024-12-20 05:28:21 +00:00
[CORDA-2923] Ensure the RPC connection is closed in Reconnection test (#5303)
This commit is contained in:
parent
b4749eb8f9
commit
50d4ab6951
@ -1,5 +1,6 @@
|
||||
package net.corda.client.rpc
|
||||
|
||||
import net.corda.client.rpc.internal.ReconnectingCordaRPCOps
|
||||
import net.corda.core.messaging.startTrackedFlow
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
@ -49,7 +50,8 @@ class CordaRPCClientReconnectionTest {
|
||||
maxReconnectAttempts = 5
|
||||
))
|
||||
|
||||
val rpcOps = client.start(rpcUser.username, rpcUser.password, gracefulReconnect = true).proxy
|
||||
(client.start(rpcUser.username, rpcUser.password, gracefulReconnect = true).proxy as ReconnectingCordaRPCOps).use {
|
||||
val rpcOps = it
|
||||
val networkParameters = rpcOps.networkParameters
|
||||
val cashStatesFeed = rpcOps.vaultTrack(Cash.State::class.java)
|
||||
cashStatesFeed.updates.subscribe { latch.countDown() }
|
||||
@ -67,6 +69,7 @@ class CordaRPCClientReconnectionTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a client can successfully unsubscribe a reconnecting observable`() {
|
||||
@ -87,7 +90,8 @@ class CordaRPCClientReconnectionTest {
|
||||
maxReconnectAttempts = 5
|
||||
))
|
||||
|
||||
val rpcOps = client.start(rpcUser.username, rpcUser.password, true).proxy
|
||||
(client.start(rpcUser.username, rpcUser.password, gracefulReconnect = true).proxy as ReconnectingCordaRPCOps).use {
|
||||
val rpcOps = it
|
||||
val cashStatesFeed = rpcOps.vaultTrack(Cash.State::class.java)
|
||||
val subscription = cashStatesFeed.updates.subscribe { latch.countDown() }
|
||||
rpcOps.startTrackedFlow(::CashIssueFlow, 10.DOLLARS, OpaqueBytes.of(0), defaultNotaryIdentity).returnValue.get()
|
||||
@ -104,6 +108,7 @@ class CordaRPCClientReconnectionTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `rpc client calls and returned observables continue working when there is failover between servers`() {
|
||||
@ -125,7 +130,8 @@ class CordaRPCClientReconnectionTest {
|
||||
maxReconnectAttempts = 5
|
||||
))
|
||||
|
||||
val rpcOps = client.start(rpcUser.username, rpcUser.password, true).proxy
|
||||
(client.start(rpcUser.username, rpcUser.password, gracefulReconnect = true).proxy as ReconnectingCordaRPCOps).use {
|
||||
val rpcOps = it
|
||||
val networkParameters = rpcOps.networkParameters
|
||||
val cashStatesFeed = rpcOps.vaultTrack(Cash.State::class.java)
|
||||
cashStatesFeed.updates.subscribe { latch.countDown() }
|
||||
@ -143,5 +149,6 @@ class CordaRPCClientReconnectionTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user