Skip to content

Commit 95f7653

Browse files
committed
Used unique port numbers during integration test
1 parent 4036b7b commit 95f7653

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

ayza/src/test/java/nl/altindag/ssl/trustmanager/HotSwappableX509ExtendedTrustManagerIT.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class HotSwappableX509ExtendedTrustManagerIT {
4646
private static SSLSocketFactory sslSocketFactory;
4747
private static SSLSessionContext sslSessionContext;
4848
private static X509ExtendedTrustManager trustManager;
49-
private static SSLFactory sslFactoryForServer;
5049

5150
@BeforeAll
5251
static void setUpSSLSocketFactory() {
@@ -61,17 +60,17 @@ static void setUpSSLSocketFactory() {
6160

6261
sslSocketFactory = sslFactory.getSslSocketFactory();
6362
sslSessionContext = sslFactory.getSslContext().getClientSessionContext();
63+
}
6464

65-
sslFactoryForServer = SSLFactory.builder()
65+
@Test
66+
@Order(1)
67+
void executeHttpsRequestWithSslSocketFactoryContainingTrustManager() throws IOException {
68+
SSLFactory sslFactoryForServer = SSLFactory.builder()
6669
.withIdentityMaterial("keystore/client-server/server-one/identity.jks", "secret".toCharArray())
6770
.withTrustMaterial("keystore/client-server/server-one/truststore.jks", "secret".toCharArray())
6871
.withNeedClientAuthentication()
6972
.build();
70-
}
7173

72-
@Test
73-
@Order(1)
74-
void executeHttpsRequestWithSslSocketFactoryContainingTrustManager() throws IOException {
7574
Server server = Server.createDefault(sslFactoryForServer, 7985);
7675

7776
HttpsURLConnection connection = (HttpsURLConnection) new URL("https://localhost:7985/api/hello").openConnection();
@@ -89,6 +88,12 @@ void executeHttpsRequestWithSslSocketFactoryContainingTrustManager() throws IOEx
8988
@Test
9089
@Order(2)
9190
void executeHttpsRequestWithExistingSslSocketFactoryContainingASwappedUnsafeTrustManager() throws IOException {
91+
SSLFactory sslFactoryForServer = SSLFactory.builder()
92+
.withIdentityMaterial("keystore/client-server/server-one/identity.jks", "secret".toCharArray())
93+
.withTrustMaterial("keystore/client-server/server-one/truststore.jks", "secret".toCharArray())
94+
.withNeedClientAuthentication()
95+
.build();
96+
9297
Server server = Server.createDefault(sslFactoryForServer, 7984);
9398

9499
KeyStore trustStoreWithClientTwo = KeyStoreUtils.loadKeyStore("keystore/client-server/client-two/truststore.jks", "secret".toCharArray());

0 commit comments

Comments
 (0)