forked from adamfisk/LittleProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
166 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/org/littleshoot/proxy/EncryptedTCPChainedProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.littleshoot.proxy; | ||
|
||
import static org.littleshoot.proxy.TransportProtocol.*; | ||
|
||
import javax.net.ssl.SSLEngine; | ||
|
||
public class EncryptedTCPChainedProxyTest extends BaseChainedProxyTest { | ||
private final SSLEngineSource sslEngineSource = new SelfSignedSSLEngineSource( | ||
"chain_proxy_keystore_1.jks"); | ||
|
||
@Override | ||
protected HttpProxyServerBootstrap downstreamProxy() { | ||
return super.downstreamProxy() | ||
.withTransportProtocol(TCP) | ||
.withSSLEngineSource(sslEngineSource); | ||
} | ||
|
||
@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 sslEngineSource.newSSLEngine(); | ||
} | ||
}; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/test/java/org/littleshoot/proxy/EncryptedUDTChainedProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.littleshoot.proxy; | ||
|
||
import static org.littleshoot.proxy.TransportProtocol.*; | ||
|
||
import javax.net.ssl.SSLEngine; | ||
|
||
public class EncryptedUDTChainedProxyTest extends BaseChainedProxyTest { | ||
private final SSLEngineSource sslEngineSource = new SelfSignedSSLEngineSource( | ||
"chain_proxy_keystore_1.jks"); | ||
|
||
@Override | ||
protected HttpProxyServerBootstrap downstreamProxy() { | ||
return super.downstreamProxy() | ||
.withTransportProtocol(UDT) | ||
.withSSLEngineSource(sslEngineSource); | ||
} | ||
|
||
@Override | ||
protected ChainedProxy newChainedProxy() { | ||
return new BaseChainedProxy() { | ||
@Override | ||
public TransportProtocol getTransportProtocol() { | ||
return TransportProtocol.UDT; | ||
} | ||
|
||
@Override | ||
public boolean requiresEncryption() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public SSLEngine newSSLEngine() { | ||
return sslEngineSource.newSSLEngine(); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/test/java/org/littleshoot/proxy/UnencryptedTCPChainedProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.littleshoot.proxy; | ||
|
||
import static org.littleshoot.proxy.TransportProtocol.*; | ||
|
||
public class UnencryptedTCPChainedProxyTest extends BaseChainedProxyTest { | ||
@Override | ||
protected HttpProxyServerBootstrap downstreamProxy() { | ||
return super.downstreamProxy() | ||
.withTransportProtocol(TCP); | ||
} | ||
|
||
@Override | ||
protected ChainedProxy newChainedProxy() { | ||
return new BaseChainedProxy() { | ||
@Override | ||
public TransportProtocol getTransportProtocol() { | ||
return TransportProtocol.TCP; | ||
} | ||
|
||
@Override | ||
public boolean requiresEncryption() { | ||
return false; | ||
} | ||
}; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/org/littleshoot/proxy/UnencryptedUDTChainedProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.littleshoot.proxy; | ||
|
||
import static org.littleshoot.proxy.TransportProtocol.*; | ||
|
||
public class UnencryptedUDTChainedProxyTest extends BaseChainedProxyTest { | ||
@Override | ||
protected HttpProxyServerBootstrap downstreamProxy() { | ||
return super.downstreamProxy() | ||
.withTransportProtocol(UDT); | ||
} | ||
|
||
@Override | ||
protected ChainedProxy newChainedProxy() { | ||
return new BaseChainedProxy() { | ||
@Override | ||
public TransportProtocol getTransportProtocol() { | ||
return TransportProtocol.UDT; | ||
} | ||
|
||
@Override | ||
public boolean requiresEncryption() { | ||
return false; | ||
} | ||
}; | ||
} | ||
} |