Code review comment: This would be (at least for now) exact copy of the method in `AthenzInstanceProviderService`? I don't think it would be easier to create mockito mock to use this, and returning actual `SslContextFactory` would probably still need to set the same fields we do in real method...

Code before review:
public void provider_service_hosts_endpoint_secured_with_tls() throws Exception {
String domain = "domain";
String service = "service";
AutoGeneratedKeyProvider keyProvider = new AutoGeneratedKeyProvider();
PrivateKey privateKey = keyProvider.getPrivateKey(0);
AthenzProviderServiceConfig config = getAthenzProviderConfig(domain, service, "vespa.dns.suffix");
SslContextFactory sslContextFactory =  AthenzInstanceProviderService.createSslContextFactory();
AthenzCertificateUpdater certificateUpdater = new AthenzCertificateUpdater(
new SelfSignedCertificateClient(keyProvider.getKeyPair(), config),
sslContextFactory,
keyProvider,
config);
ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
when(executor.awaitTermination(anyLong(), any())).thenReturn(true);
InstanceValidator instanceValidator = mock(InstanceValidator.class);
when(instanceValidator.isValidInstance(any())).thenReturn(true);
IdentityDocumentGenerator identityDocumentGenerator = mock(IdentityDocumentGenerator.class);
AthenzInstanceProviderService athenzInstanceProviderService = new AthenzInstanceProviderService(
config, executor, ZONE, sslContextFactory, instanceValidator, identityDocumentGenerator, certificateUpdater);
try (CloseableHttpClient client = createHttpClient(domain, service)) {
assertFalse(getStatus(client));
certificateUpdater.run();
assertTrue(getStatus(client));
assertInstanceConfirmationSucceeds(client, privateKey);
certificateUpdater.run();
assertTrue(getStatus(client));
assertInstanceConfirmationSucceeds(client, privateKey);
} finally {
athenzInstanceProviderService.deconstruct();
}
}

Line under review: SslContextFactory sslContextFactory =  AthenzInstanceProviderService.createSslContextFactory();

Code after addressing the review:
public void provider_service_hosts_endpoint_secured_with_tls() throws Exception {
String domain = "domain";
String service = "service";
AutoGeneratedKeyProvider keyProvider = new AutoGeneratedKeyProvider();
PrivateKey privateKey = keyProvider.getPrivateKey(0);
AthenzProviderServiceConfig config = getAthenzProviderConfig(domain, service, "vespa.dns.suffix", ZONE);
SslContextFactory sslContextFactory =  AthenzInstanceProviderService.createSslContextFactory();
AthenzCertificateUpdater certificateUpdater = new AthenzCertificateUpdater(
new SelfSignedCertificateClient(keyProvider.getKeyPair(), config, getZoneConfig(config, ZONE)),
sslContextFactory,
keyProvider,
config,
getZoneConfig(config, ZONE));
ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
when(executor.awaitTermination(anyLong(), any())).thenReturn(true);
InstanceValidator instanceValidator = mock(InstanceValidator.class);
when(instanceValidator.isValidInstance(any())).thenReturn(true);
IdentityDocumentGenerator identityDocumentGenerator = mock(IdentityDocumentGenerator.class);
AthenzInstanceProviderService athenzInstanceProviderService = new AthenzInstanceProviderService(
config, executor, ZONE, sslContextFactory, instanceValidator, identityDocumentGenerator, certificateUpdater);
try (CloseableHttpClient client = createHttpClient(domain, service)) {
assertFalse(getStatus(client));
certificateUpdater.run();
assertTrue(getStatus(client));
assertInstanceConfirmationSucceeds(client, privateKey);
certificateUpdater.run();
assertTrue(getStatus(client));
assertInstanceConfirmationSucceeds(client, privateKey);
} finally {
athenzInstanceProviderService.deconstruct();
}
}