1818import org .eclipse .jetty .http3 .HTTP3ErrorCode ;
1919import org .eclipse .jetty .http3 .HTTP3Exception ;
2020import org .eclipse .jetty .http3 .HTTP3Session ;
21+ import org .eclipse .jetty .http3 .HTTP3Stream ;
2122import org .eclipse .jetty .http3 .api .Session ;
2223import org .eclipse .jetty .http3 .api .Stream ;
2324import org .eclipse .jetty .http3 .client .internal .ClientHTTP3Session ;
2627import org .eclipse .jetty .http3 .frames .GoAwayFrame ;
2728import org .eclipse .jetty .http3 .frames .HeadersFrame ;
2829import org .eclipse .jetty .http3 .frames .SettingsFrame ;
30+ import org .eclipse .jetty .quic .common .ProtocolSession ;
2931import org .eclipse .jetty .quic .common .ProtocolStreamListener ;
3032import org .eclipse .jetty .quic .common .StreamEndPoint ;
3133import org .eclipse .jetty .util .Callback ;
@@ -40,16 +42,17 @@ public class HTTP3SessionClient extends HTTP3Session implements Session.Client
4042
4143 private final Promise .Invocable <Client > promise ;
4244
43- public HTTP3SessionClient (Scheduler scheduler , ClientHTTP3Session session , Client .Listener listener , Promise .Invocable <Client > promise )
45+ public HTTP3SessionClient (Scheduler scheduler , ProtocolSession session , Client .Listener listener , Promise .Invocable <Client > promise )
4446 {
4547 super (scheduler , session , listener );
48+ if (!(session instanceof ClientHTTP3Session ))
49+ throw new IllegalArgumentException ("Invalid session: " + session );
4650 this .promise = promise ;
4751 }
4852
49- @ Override
50- public ClientHTTP3Session getProtocolSession ()
53+ private ClientHTTP3Session getClientHTTP3Session ()
5154 {
52- return (ClientHTTP3Session )super . getProtocolSession ();
55+ return (ClientHTTP3Session )getProtocolSession ();
5356 }
5457
5558 @ Override
@@ -61,7 +64,7 @@ public void onOpen()
6164 }
6265
6366 @ Override
64- protected HTTP3StreamClient newHTTP3Stream (StreamEndPoint endPoint , boolean local )
67+ protected HTTP3Stream newHTTP3Stream (StreamEndPoint endPoint , boolean local )
6568 {
6669 return new HTTP3StreamClient (this , endPoint , local );
6770 }
@@ -91,14 +94,14 @@ public void onSettings(SettingsFrame frame)
9194 {
9295 if (LOG .isDebugEnabled ())
9396 LOG .debug ("received {} on {}" , frame , this );
94- getProtocolSession ().onSettings (frame );
97+ getClientHTTP3Session ().onSettings (frame );
9598 super .onSettings (frame );
9699 }
97100
98101 @ Override
99102 public void newRequest (HeadersFrame frame , Stream .Client .Listener listener , Promise .Invocable <Stream > promise )
100103 {
101- ClientHTTP3Session protocolSession = getProtocolSession ();
104+ ClientHTTP3Session protocolSession = getClientHTTP3Session ();
102105 var quicSession = protocolSession .getSession ();
103106 long streamId = quicSession .newStreamId (true );
104107 AtomicReference <StreamEndPoint > endPointRef = new AtomicReference <>();
@@ -139,7 +142,7 @@ public void succeeded(Stream result)
139142 public void failed (Throwable x )
140143 {
141144 stream .updateClose (frame .isLast (), true );
142- Promise . Invocable <Stream > p = Promise . Invocable .from (getInvocationType (), s -> promise .failed (x ), t -> promise .failed (x ));
145+ Invocable <Stream > p = Invocable .from (getInvocationType (), s -> promise .failed (x ), t -> promise .failed (x ));
143146 stream .disconnect (HTTP3ErrorCode .REQUEST_CANCELLED_ERROR .code (), x , p );
144147 }
145148 });
@@ -148,13 +151,13 @@ public void failed(Throwable x)
148151 @ Override
149152 public void writeControlFrame (Frame frame , Callback callback )
150153 {
151- getProtocolSession ().writeControlFrame (frame , callback );
154+ getClientHTTP3Session ().writeControlFrame (frame , callback );
152155 }
153156
154157 @ Override
155158 public void writeMessageFrame (StreamEndPoint streamEndPoint , Frame frame , Callback callback )
156159 {
157- getProtocolSession ().writeMessageFrame (streamEndPoint , frame , callback );
160+ getClientHTTP3Session ().writeMessageFrame (streamEndPoint , frame , callback );
158161 }
159162
160163 @ Override
0 commit comments