@@ -62,6 +62,18 @@ public final class H2OverH2TunnelSupport {
6262 private H2OverH2TunnelSupport () {
6363 }
6464
65+ /**
66+ * Establishes a CONNECT tunnel and returns the resulting {@link ProtocolIOSession}
67+ * via the callback. The tunnel session supports optional TLS upgrade.
68+ *
69+ * @param proxySession the HTTP/2 session to the proxy
70+ * @param target the target endpoint for the CONNECT request authority
71+ * @param connectTimeout timeout for the CONNECT handshake
72+ * @param secure whether to upgrade the tunnel to TLS after establishment
73+ * @param tlsStrategy TLS strategy for the upgrade (required when {@code secure} is true)
74+ * @param callback completion callback receiving the tunnel session
75+ * @since 5.7
76+ */
6577 public static void establish (
6678 final IOSession proxySession ,
6779 final NamedEndpoint target ,
@@ -72,6 +84,19 @@ public static void establish(
7284 establishInternal (proxySession , target , connectTimeout , secure , tlsStrategy , null , null , callback );
7385 }
7486
87+ /**
88+ * Establishes a CONNECT tunnel with a request interceptor for injecting
89+ * headers (e.g. proxy authentication) into the CONNECT request.
90+ *
91+ * @param proxySession the HTTP/2 session to the proxy
92+ * @param target the target endpoint for the CONNECT request authority
93+ * @param connectTimeout timeout for the CONNECT handshake
94+ * @param secure whether to upgrade the tunnel to TLS after establishment
95+ * @param tlsStrategy TLS strategy for the upgrade (required when {@code secure} is true)
96+ * @param connectRequestInterceptor interceptor applied to the CONNECT request before sending
97+ * @param callback completion callback receiving the tunnel session
98+ * @since 5.7
99+ */
75100 public static void establish (
76101 final IOSession proxySession ,
77102 final NamedEndpoint target ,
@@ -83,6 +108,20 @@ public static void establish(
83108 establishInternal (proxySession , target , connectTimeout , secure , tlsStrategy , connectRequestInterceptor , null , callback );
84109 }
85110
111+ /**
112+ * Establishes a CONNECT tunnel and starts a protocol handler inside it.
113+ * The protocol starter factory creates an {@link org.apache.hc.core5.reactor.IOEventHandler}
114+ * that is connected to the tunnel session immediately after establishment.
115+ *
116+ * @param proxySession the HTTP/2 session to the proxy
117+ * @param target the target endpoint for the CONNECT request authority
118+ * @param connectTimeout timeout for the CONNECT handshake
119+ * @param secure whether to upgrade the tunnel to TLS after establishment
120+ * @param tlsStrategy TLS strategy for the upgrade (required when {@code secure} is true)
121+ * @param protocolStarter factory for the protocol handler to run inside the tunnel
122+ * @param callback completion callback receiving the tunnel session
123+ * @since 5.7
124+ */
86125 public static void establish (
87126 final IOSession proxySession ,
88127 final NamedEndpoint target ,
@@ -94,6 +133,21 @@ public static void establish(
94133 establish (proxySession , target , connectTimeout , secure , tlsStrategy , null , protocolStarter , callback );
95134 }
96135
136+ /**
137+ * Establishes a CONNECT tunnel with both a request interceptor and a protocol starter.
138+ * This is the most general overload combining proxy authentication support with
139+ * automatic protocol initialization inside the tunnel.
140+ *
141+ * @param proxySession the HTTP/2 session to the proxy
142+ * @param target the target endpoint for the CONNECT request authority
143+ * @param connectTimeout timeout for the CONNECT handshake
144+ * @param secure whether to upgrade the tunnel to TLS after establishment
145+ * @param tlsStrategy TLS strategy for the upgrade (required when {@code secure} is true)
146+ * @param connectRequestInterceptor interceptor applied to the CONNECT request before sending
147+ * @param protocolStarter factory for the protocol handler to run inside the tunnel
148+ * @param callback completion callback receiving the tunnel session
149+ * @since 5.7
150+ */
97151 public static void establish (
98152 final IOSession proxySession ,
99153 final NamedEndpoint target ,
0 commit comments