Checking my android app is connected

i’m connecting to a cluster using java and when i try to get a list of my databases i receive this message:
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]

how can i check if my client is connected or not ???
thanks to all of you !