org.littleshoot.proxy.ChainedProxy Java Examples

The following examples show how to use org.littleshoot.proxy.ChainedProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #2
Source File: ProxyToServerConnection.java    From g4proxy with Apache License 2.0 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #3
Source File: ProxyToServerConnection.java    From yfs with Apache License 2.0 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #4
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
                                      ClientToProxyConnection clientConnection,
                                      String serverHostAndPort,
                                      HttpFilters initialFilters,
                                      HttpRequest initialHttpRequest,
                                      GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies, clientConnection.getClientDetails());
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #5
Source File: ProxyToServerConnection.java    From g4proxy with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 *
 * @param proxyServer
 * @param clientConnection
 * @param serverHostAndPort
 * @param initialFilters
 * @param initialHttpRequest
 * @return
 * @throws UnknownHostException
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        HttpFilters initialFilters,
        HttpRequest initialHttpRequest,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies);
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #6
Source File: ProxyToServerConnection.java    From yfs with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 *
 * @param proxyServer
 * @param clientConnection
 * @param serverHostAndPort
 * @param initialFilters
 * @param initialHttpRequest
 * @return
 * @throws UnknownHostException
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
                                      ClientToProxyConnection clientConnection,
                                      String serverHostAndPort,
                                      HttpFilters initialFilters,
                                      HttpRequest initialHttpRequest,
                                      GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies);
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #7
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 4 votes vote down vote up
public ChainedProxy getChainedProxy() {
    return chainedProxy;
}
 
Example #8
Source File: ProxyToServerConnection.java    From g4proxy with Apache License 2.0 4 votes vote down vote up
public ChainedProxy getChainedProxy() {
    return chainedProxy;
}
 
Example #9
Source File: ProxyToServerConnection.java    From yfs with Apache License 2.0 4 votes vote down vote up
public ChainedProxy getChainedProxy() {
    return chainedProxy;
}