Skip to content

Commit 4f80aec

Browse files
committed
anotzher external test (https) has been added
1 parent 1cc43dc commit 4f80aec

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/test/java/website/magyar/mitm/proxy/MitmComplexProxyWithExternalServerTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,23 @@ public void testSimpleRemoteGetRequestOverHTTPSWithoutProxy() throws Exception {
104104
assertEquals(0, requestCount.get());
105105
}
106106

107+
@Test
108+
public void testSimpleRemoteGetRequestOverHTTPSThroughProxy_Self() throws Exception {
109+
//check if external test server is available
110+
String CALL = "/";
111+
HttpHost externalHost = new HttpHost("mitmjavaproxy.magyar.website", 443, "https");
112+
try {
113+
httpGetWithApacheClient(externalHost, CALL, false, false, ContentEncoding.ANY);
114+
} catch (Exception e) {
115+
externalHost = null;
116+
}
117+
org.junit.Assume.assumeTrue(externalHost != null);
118+
//do test if available
119+
ResponseInfo proxiedResponse = httpGetWithApacheClient(externalHost, CALL, true, false, ContentEncoding.ANY);
120+
assertEquals(200, proxiedResponse.getStatusCode());
121+
assertTrue(requestCount.get() > 0);
122+
assertTrue(responseCount.get() > 0);
123+
assertEquals(requestCount.get(), responseCount.get());
124+
}
107125

108126
}

src/test/java/website/magyar/mitm/proxy/help/TestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void handle(String target,
118118

119119
if (enableHttps) {
120120
// Add SSL connector
121-
SslContextFactory sslContextFactory = new SslContextFactory.Server.Server();
121+
SslContextFactory sslContextFactory = new SslContextFactory.Server();
122122

123123
SelfSignedSslEngineSource contextSource = new SelfSignedSslEngineSource();
124124
SSLContext sslContext = contextSource.getSslContext();

0 commit comments

Comments
 (0)