How can I catch remote server timeout exception?

I use Couchbase Lite to replicate data in a P2P network on Android platform. Sometimes the remote peer may be offline, when I try to pull/push data with remote offline peer, I wanna know that it is offline and I can do something to handle this exception. I thought replication.start() will throw this kind of exception, but it does not, so how can I catch this exception?