org.littleshoot.proxy.ChainedProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of littleproxy Show documentation
Show all versions of littleproxy Show documentation
LittleProxy is a high performance HTTP proxy written in Java and using the Netty networking framework.
package org.littleshoot.proxy;
import io.netty.handler.codec.http.HttpObject;
import java.net.InetSocketAddress;
/**
*
* Encapsulates information needed to connect to a chained proxy.
*
*
*
* Sub-classes may wish to extend {@link ChainedProxyAdapter} for sensible
* defaults.
*
*/
public interface ChainedProxy extends SslEngineSource {
/**
* Return the {@link InetSocketAddress} for connecting to the chained proxy.
* Returning null indicates that we won't chain.
*
* @return The Chain Proxy with Host and Port.
*/
InetSocketAddress getChainedProxyAddress();
/**
* (Optional) ensure that the connection is opened from a specific local
* address (useful when doing NAT traversal).
*
* @return
*/
InetSocketAddress getLocalAddress();
/**
* Tell LittleProxy what kind of TransportProtocol to use to communicate
* with the chained proxy.
*
* @return
*/
TransportProtocol getTransportProtocol();
/**
* Implement this method to tell LittleProxy whether or not to encrypt
* connections to the chained proxy for the given request. If true,
* LittleProxy will call {@link SslEngineSource#newSslEngine()} to obtain an
* SSLContext used by the downstream proxy.
*
* @return true of the connection to the chained proxy should be encrypted
*/
boolean requiresEncryption();
/**
* Filters requests on their way to the chained proxy.
*
* @param httpObject
*/
void filterRequest(HttpObject httpObject);
/**
* Called to let us know that connecting to this proxy succeeded.
*/
void connectionSucceeded();
/**
* Called to let us know that connecting to this proxy failed.
*
* @param cause
* exception that caused this failure (may be null)
*/
void connectionFailed(Throwable cause);
/**
* Called to let us know that we were disconnected.
*/
void disconnected();
}