try {
vcapUrl = new URL(VCAP_TARGET);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
CloudFoundryClient client = new CloudFoundryClient(new CloudCredentials(VCAP_EMAIL, VCAP_PASSWD), vcapUrl);
client.login();
String version = client.getCloudInfo().getVersion();
if (Float.valueOf(version) >= 2.0) {
client = new CloudFoundryClient(new CloudCredentials(VCAP_EMAIL, VCAP_PASSWD), vcapUrl, getSpace(client));
client.login();
}
return client;
}