forked from verygoodsecurity/LittleProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMitmWithClientAuthenticationNotRequiredTCPChainedProxyTest.java
More file actions
53 lines (43 loc) · 1.64 KB
/
MitmWithClientAuthenticationNotRequiredTCPChainedProxyTest.java
File metadata and controls
53 lines (43 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.littleshoot.proxy;
import static org.littleshoot.proxy.TransportProtocol.*;
import javax.net.ssl.SSLEngine;
import org.littleshoot.proxy.extras.SelfSignedSslEngineSource;
/**
* Tests that when client authentication is not required, it doesn't matter what
* certs the client sends.
*/
public class MitmWithClientAuthenticationNotRequiredTCPChainedProxyTest extends
MitmWithChainedProxyTest {
private final SslEngineSource serverSslEngineSource = new SelfSignedSslEngineSource(
"chain_proxy_keystore_1.jks");
private final SslEngineSource clientSslEngineSource = new SelfSignedSslEngineSource(
"chain_proxy_keystore_1.jks", false, false);
@Override
protected HttpProxyServerBootstrap upstreamProxy() {
return super.upstreamProxy()
.withTransportProtocol(TCP)
.withSslEngineSource(serverSslEngineSource)
.withAuthenticateSslClients(false);
}
@Override
protected ChainedProxy newChainedProxy() {
return new BaseChainedProxy() {
@Override
public TransportProtocol getTransportProtocol() {
return TransportProtocol.TCP;
}
@Override
public boolean requiresEncryption() {
return true;
}
@Override
public SSLEngine newSslEngine() {
return clientSslEngineSource.newSslEngine();
}
@Override
public SSLEngine newSslEngine(String peerHost, int peerPort) {
return clientSslEngineSource.newSslEngine(peerHost, peerPort);
}
};
}
}