try {
doConnect();
} catch (SocketTimeoutException e) {
throw new ConnectionTimeoutException();
} catch (IOException e) {
throw new ConnectionFailedException(e.getClass().getName() + " : "+ e.getMessage());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ConnectionHandshakeException("Handshake interrupted");
} catch (ConnectionHandshakeException e) {
throw e;
} catch (ConnectionIOException e) {
throw new ConnectionFailedException(e.getMessage());
}
isConnected = true;
}
}