org.littleshoot.proxy
Class ChainedProxyAdapter

java.lang.Object
  extended by org.littleshoot.proxy.ChainedProxyAdapter
All Implemented Interfaces:
ChainedProxy, SslEngineSource

public class ChainedProxyAdapter
extends Object
implements ChainedProxy

Convenience base class for implementations of ChainedProxy.


Field Summary
static ChainedProxy FALLBACK_TO_DIRECT_CONNECTION
          ChainedProxy that simply has the downstream proxy make a direct connection to the upstream server.
 
Constructor Summary
ChainedProxyAdapter()
           
 
Method Summary
 void connectionFailed(Throwable cause)
          Called to let us know that connecting to this proxy failed.
 void connectionSucceeded()
          Called to let us know that connecting to this proxy succeeded.
 void disconnected()
          Called to let us know that we were disconnected.
 void filterRequest(io.netty.handler.codec.http.HttpObject httpObject)
          Filters requests on their way to the chained proxy.
 InetSocketAddress getChainedProxyAddress()
          Return the InetSocketAddress for connecting to the chained proxy.
 InetSocketAddress getLocalAddress()
          (Optional) ensure that the connection is opened from a specific local address (useful when doing NAT traversal).
 TransportProtocol getTransportProtocol()
          Tell LittleProxy what kind of TransportProtocol to use to communicate with the chained proxy.
 SSLEngine newSslEngine()
           
 boolean requiresEncryption()
          Implement this method to tell LittleProxy whether or not to encrypt connections to the chained proxy for the given request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FALLBACK_TO_DIRECT_CONNECTION

public static ChainedProxy FALLBACK_TO_DIRECT_CONNECTION
ChainedProxy that simply has the downstream proxy make a direct connection to the upstream server.

Constructor Detail

ChainedProxyAdapter

public ChainedProxyAdapter()
Method Detail

getChainedProxyAddress

public InetSocketAddress getChainedProxyAddress()
Description copied from interface: ChainedProxy
Return the InetSocketAddress for connecting to the chained proxy. Returning null indicates that we won't chain.

Specified by:
getChainedProxyAddress in interface ChainedProxy
Returns:
The Chain Proxy with Host and Port.

getLocalAddress

public InetSocketAddress getLocalAddress()
Description copied from interface: ChainedProxy
(Optional) ensure that the connection is opened from a specific local address (useful when doing NAT traversal).

Specified by:
getLocalAddress in interface ChainedProxy
Returns:

getTransportProtocol

public TransportProtocol getTransportProtocol()
Description copied from interface: ChainedProxy
Tell LittleProxy what kind of TransportProtocol to use to communicate with the chained proxy.

Specified by:
getTransportProtocol in interface ChainedProxy
Returns:

requiresEncryption

public boolean requiresEncryption()
Description copied from interface: ChainedProxy
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 SslEngineSource.newSslEngine() to obtain an SSLContext used by the downstream proxy.

Specified by:
requiresEncryption in interface ChainedProxy
Returns:
true of the connection to the chained proxy should be encrypted

newSslEngine

public SSLEngine newSslEngine()
Specified by:
newSslEngine in interface SslEngineSource

filterRequest

public void filterRequest(io.netty.handler.codec.http.HttpObject httpObject)
Description copied from interface: ChainedProxy
Filters requests on their way to the chained proxy.

Specified by:
filterRequest in interface ChainedProxy

connectionSucceeded

public void connectionSucceeded()
Description copied from interface: ChainedProxy
Called to let us know that connecting to this proxy succeeded.

Specified by:
connectionSucceeded in interface ChainedProxy

connectionFailed

public void connectionFailed(Throwable cause)
Description copied from interface: ChainedProxy
Called to let us know that connecting to this proxy failed.

Specified by:
connectionFailed in interface ChainedProxy
Parameters:
cause - exception that caused this failure (may be null)

disconnected

public void disconnected()
Description copied from interface: ChainedProxy
Called to let us know that we were disconnected.

Specified by:
disconnected in interface ChainedProxy


Copyright © 2009-2014 LittleShoot. All Rights Reserved.