handshakeFuture can be null

If the if clause fails before it has ever succeeded, handshakeFuture
will be null, the test for isDone then fails.

BugzID: 18623
Merge pull request #1 from cloudant/18623-null-pointer-exception

handshakeFuture can be null