use of io.airlift.testing.TempFile in project airlift by airlift.
the class TestHttpServerProvider method testKeystoreReloading.
@Test
public void testKeystoreReloading() throws Exception {
try (TempFile tempFile = new TempFile()) {
appendCertificate(tempFile.file(), "certificate-1");
config.setHttpsEnabled(true).setHttpEnabled(false);
httpsConfig.setSslContextRefreshTime(new Duration(5, SECONDS)).setKeystorePath(tempFile.file().getAbsolutePath()).setKeystorePassword("airlift");
createAndStartServer();
assertEventually(() -> assertEquals(server.getCertificates().size(), 1));
appendCertificate(tempFile.file(), "certificate-2");
assertEventually(() -> assertEquals(server.getCertificates().size(), 2));
}
}