mirror of
https://github.com/corda/corda.git
synced 2025-01-29 15:43:55 +00:00
ENT-1670: update kdocs and unit test for better user experience (#2875)
* ENT-1670: update kdocs and unit test for better user experience regarding RPC connection loss * RPCStabilityTests: move doOnError logic to onError handler
This commit is contained in:
parent
c3031b182b
commit
47c7be62c0
@ -305,16 +305,21 @@ class RPCStabilityTests {
|
||||
|
||||
var terminateHandlerCalled = false
|
||||
var errorHandlerCalled = false
|
||||
var exceptionMessage: String? = null
|
||||
val subscription = client.subscribe()
|
||||
.doOnTerminate{ terminateHandlerCalled = true }
|
||||
.doOnError { errorHandlerCalled = true }
|
||||
.subscribe()
|
||||
.subscribe({}, {
|
||||
errorHandlerCalled = true
|
||||
//log exception
|
||||
exceptionMessage = it.message
|
||||
})
|
||||
|
||||
serverFollower.shutdown()
|
||||
Thread.sleep(100)
|
||||
|
||||
assertTrue(terminateHandlerCalled)
|
||||
assertTrue(errorHandlerCalled)
|
||||
assertEquals("Connection failure detected.", exceptionMessage)
|
||||
assertTrue(subscription.isUnsubscribed)
|
||||
|
||||
clientFollower.shutdown() // Driver would do this after the new server, causing hang.
|
||||
|
@ -89,6 +89,10 @@ interface CordaRPCClientConfiguration {
|
||||
* with an error, the observable is closed and you can't then re-subscribe again: you'll have to re-request a fresh
|
||||
* observable with another RPC.
|
||||
*
|
||||
* In case of loss of connection to the server, the client will try to reconnect using the settings provided via
|
||||
* [CordaRPCClientConfiguration]. While attempting failover, current and future RPC calls will throw
|
||||
* [RPCException] and previously returned observables will call onError().
|
||||
*
|
||||
* @param hostAndPort The network address to connect to.
|
||||
* @param configuration An optional configuration used to tweak client behaviour.
|
||||
* @param sslConfiguration An optional [SSLConfiguration] used to enable secure communication with the server.
|
||||
|
Loading…
x
Reference in New Issue
Block a user