org.littleshoot.proxy.FlowContext 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 org.littleshoot.proxy.impl.ClientToProxyConnection;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
import java.net.InetSocketAddress;
/**
*
* Encapsulates contextual information for flow information that's being
* reported to a {@link ActivityTracker}.
*
*/
public class FlowContext {
private final InetSocketAddress clientAddress;
private final SSLSession clientSslSession;
public FlowContext(ClientToProxyConnection clientConnection) {
clientAddress = clientConnection.getClientAddress();
SSLEngine sslEngine = clientConnection.getSslEngine();
clientSslSession = sslEngine != null ? sslEngine.getSession() : null;
}
/**
* The address of the client.
*/
public InetSocketAddress getClientAddress() {
return clientAddress;
}
/**
* If using SSL, this returns the {@link SSLSession} on the client
* connection.
*/
public SSLSession getClientSslSession() {
return clientSslSession;
}
}