I am writing one app in Kotlin to connect to grpc server and fetch data.
Below is my code snippet :
channel = ManagedChannelBuilder.forTarget("localhost:25001")
.usePlaintext()
.build()
stub = hello.HelloGrpc.newBlockingStub(channel)
My GRPC Server is down, but i can see value for both variable as below :
for channel = channelManagedChannelOrphanWrapper{delegate=ManagedChannelImpl{logId=1, target=localhost:25001}}
for stub = channelhello.HelloGrpc$HelloBlockingStub@19b843ba
I am confused, how to check if connection is not active.
For now, i have added try catch statement while fetching value, which is throwing me an error
UNAVAILABLE: io exception
Just wondering, Is there any way by which I can check my connection status and try to re-connect for broken connection.