Home / Class/ ProxyHandler Class — netty Architecture

ProxyHandler Class — netty Architecture

Architecture documentation for the ProxyHandler class in ProxyHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99["ProxyHandler"]
  bb058247_44c2_a27d_ff62_841a1e3d09e7["ProxyHandler.java"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|defined in| bb058247_44c2_a27d_ff62_841a1e3d09e7
  ddb9cb21_9385_a5ef_5ab3_994edbaf8fa3["ProxyHandler()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| ddb9cb21_9385_a5ef_5ab3_994edbaf8fa3
  fea6e907_4b7e_17e4_8b2e_3a9b304a7028["String()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| fea6e907_4b7e_17e4_8b2e_3a9b304a7028
  e6e45a58_19bf_0bf2_e88d_1fd8ca2a4540["T()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| e6e45a58_19bf_0bf2_e88d_1fd8ca2a4540
  78433613_8650_1376_009b_c92f9572c4a6["isConnected()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 78433613_8650_1376_009b_c92f9572c4a6
  f2ccdd1b_cf1b_c4ea_4f6a_e03f9b93d6bc["connectFuture()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| f2ccdd1b_cf1b_c4ea_4f6a_e03f9b93d6bc
  6b489137_745d_770b_d3ab_e4a2eaea246d["connectTimeoutMillis()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 6b489137_745d_770b_d3ab_e4a2eaea246d
  2592a465_5b69_1e3a_67c8_b214cd2a8f54["setConnectTimeoutMillis()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 2592a465_5b69_1e3a_67c8_b214cd2a8f54
  da781d19_5c1d_4dd3_b6b2_67a2104c7c27["handlerAdded()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| da781d19_5c1d_4dd3_b6b2_67a2104c7c27
  282f0e5f_9a4a_855d_1f3b_0f799e58eeed["addCodec()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 282f0e5f_9a4a_855d_1f3b_0f799e58eeed
  77d96c32_2c14_bd21_3aff_22ac9a76cc5b["removeEncoder()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 77d96c32_2c14_bd21_3aff_22ac9a76cc5b
  ba420f0b_212a_cfff_a0af_1ff374b4a273["removeDecoder()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| ba420f0b_212a_cfff_a0af_1ff374b4a273
  81b235db_4bdb_8ca6_5e9c_c5f232876ed2["connect()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 81b235db_4bdb_8ca6_5e9c_c5f232876ed2
  96c215c5_320d_e6f2_5984_ce66a5cc0bed["channelActive()"]
  3f5c9c39_cf82_6deb_e43b_1a9ad5499a99 -->|method| 96c215c5_320d_e6f2_5984_ce66a5cc0bed

Relationship Graph

Source Code

handler-proxy/src/main/java/io/netty/handler/proxy/ProxyHandler.java lines 40–455

public abstract class ProxyHandler extends ChannelDuplexHandler {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(ProxyHandler.class);

    /**
     * The default connect timeout: 10 seconds.
     */
    private static final long DEFAULT_CONNECT_TIMEOUT_MILLIS = 10000;

    /**
     * A string that signifies 'no authentication' or 'anonymous'.
     */
    static final String AUTH_NONE = "none";

    private final SocketAddress proxyAddress;
    private volatile SocketAddress destinationAddress;
    private volatile long connectTimeoutMillis = DEFAULT_CONNECT_TIMEOUT_MILLIS;

    private volatile ChannelHandlerContext ctx;
    private PendingWriteQueue pendingWrites;
    private boolean finished;
    private boolean suppressChannelReadComplete;
    private boolean flushedPrematurely;
    private final LazyChannelPromise connectPromise = new LazyChannelPromise();
    private Future<?> connectTimeoutFuture;
    private final ChannelFutureListener writeListener = future -> {
        if (!future.isSuccess()) {
            setConnectFailure(future.cause());
        }
    };

    protected ProxyHandler(SocketAddress proxyAddress) {
        this.proxyAddress = ObjectUtil.checkNotNull(proxyAddress, "proxyAddress");
    }

    /**
     * Returns the name of the proxy protocol in use.
     */
    public abstract String protocol();

    /**
     * Returns the name of the authentication scheme in use.
     */
    public abstract String authScheme();

    /**
     * Returns the address of the proxy server.
     */
    @SuppressWarnings("unchecked")
    public final <T extends SocketAddress> T proxyAddress() {
        return (T) proxyAddress;
    }

    /**
     * Returns the address of the destination to connect to via the proxy server.
     */
    @SuppressWarnings("unchecked")
    public final <T extends SocketAddress> T destinationAddress() {
        return (T) destinationAddress;
    }

    /**
     * Returns {@code true} if and only if the connection to the destination has been established successfully.
     */
    public final boolean isConnected() {
        return connectPromise.isSuccess();
    }

    /**
     * Returns a {@link Future} that is notified when the connection to the destination has been established
     * or the connection attempt has failed.
     */
    public final Future<Channel> connectFuture() {
        return connectPromise;
    }

    /**
     * Returns the connect timeout in millis.  If the connection attempt to the destination does not finish within
     * the timeout, the connection attempt will be failed.
     */
    public final long connectTimeoutMillis() {

Frequently Asked Questions

What is the ProxyHandler class?
ProxyHandler is a class in the netty codebase, defined in handler-proxy/src/main/java/io/netty/handler/proxy/ProxyHandler.java.
Where is ProxyHandler defined?
ProxyHandler is defined in handler-proxy/src/main/java/io/netty/handler/proxy/ProxyHandler.java at line 40.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free