|
13 | 13 | import org.junit.Test; |
14 | 14 | import org.mockito.Mockito; |
15 | 15 |
|
| 16 | +import java.io.FileInputStream; |
| 17 | +import java.io.FileNotFoundException; |
16 | 18 | import java.net.MalformedURLException; |
17 | 19 | import java.net.URL; |
18 | 20 | import java.util.List; |
@@ -260,7 +262,7 @@ public Map<String, List<String>> getHeaderOverrides(RequestContext context) { |
260 | 262 | } |
261 | 263 |
|
262 | 264 | @Test |
263 | | - public void checkProxyParams() throws MalformedURLException { |
| 265 | + public void checkProxyParams() throws MalformedURLException, FileNotFoundException { |
264 | 266 | SplitClientConfig config = SplitClientConfig.builder() |
265 | 267 | .proxyConfiguration(new ProxyConfiguration.Builder() |
266 | 268 | .url(new URL("https://proxy-host:8888")) |
@@ -304,14 +306,14 @@ public String getToken() { |
304 | 306 | .build()) |
305 | 307 | .build(); |
306 | 308 | Assert.assertEquals(bearerCredentialsProvider, config.proxyConfiguration().getProxyCredentialsProvider()); |
307 | | - |
| 309 | + FileInputStream p12File = new FileInputStream("src/test/resources/keyStore.p12"); |
308 | 310 | config = SplitClientConfig.builder() |
309 | 311 | .proxyConfiguration(new ProxyConfiguration.Builder() |
310 | 312 | .url(new URL("https://proxy-host:888")) |
311 | | - .mtls("path/to/file", "pass-key") |
| 313 | + .mtls(p12File, "pass-key") |
312 | 314 | .build()) |
313 | 315 | .build(); |
314 | | - Assert.assertEquals("path/to/file", config.proxyConfiguration().getP12File()); |
| 316 | + Assert.assertEquals(p12File, config.proxyConfiguration().getP12File()); |
315 | 317 | Assert.assertEquals("pass-key", config.proxyConfiguration().getPassKey()); |
316 | 318 | } |
317 | 319 |
|
@@ -352,11 +354,11 @@ public void mustUseP12FileWithProxyMtls() throws MalformedURLException { |
352 | 354 | } |
353 | 355 |
|
354 | 356 | @Test(expected = IllegalArgumentException.class) |
355 | | - public void mustUseP12PassKeyWithProxyMtls() throws MalformedURLException { |
| 357 | + public void mustUseP12PassKeyWithProxyMtls() throws MalformedURLException, FileNotFoundException { |
356 | 358 | SplitClientConfig.builder() |
357 | 359 | .proxyConfiguration(new ProxyConfiguration.Builder() |
358 | 360 | .url(new URL("https://proxy-host:888")) |
359 | | - .mtls("path/to/file", null) |
| 361 | + .mtls(new FileInputStream("src/test/resources/keyStore.p12"), null) |
360 | 362 | .build()) |
361 | 363 | .build(); |
362 | 364 | } |
|
0 commit comments