private void validateConnection(RegistryHostSpec hostSpec, Operation op, boolean storeHost) { validatePlainHttpConnection(this, hostSpec, op, () -> validateSslTrust(this, hostSpec, op, () -> { if (hostSpec.sslTrust != null && hostSpec.hostState != null) { if (hostSpec.hostState.customProperties == null) { hostSpec.hostState.customProperties = new HashMap<>(); } hostSpec.hostState.customProperties.put(RegistryService .REGISTRY_TRUST_CERTS_PROP_NAME, UriUtils .buildUriPath( SslTrustCertificateService .FACTORY_LINK, hostSpec .sslTrust.documentSelfLink)); } pingHost(hostSpec, op, hostSpec.sslTrust, () -> { if (storeHost) { storeHost(hostSpec, op); } else { completeOperationSuccess(op); } }); }) ); }