accept the control stream and parse SETTINGS frame, for the H3 client

This commit is contained in:
Marten Seemann 2020-12-21 17:58:57 +07:00
parent f92b0ec74a
commit 808671e2d4
3 changed files with 205 additions and 10 deletions

View file

@ -101,6 +101,10 @@ var _ = Describe("RoundTripper", func() {
session.EXPECT().OpenUniStream().AnyTimes().Return(nil, testErr)
session.EXPECT().HandshakeComplete().Return(handshakeCtx)
session.EXPECT().OpenStreamSync(context.Background()).Return(nil, testErr)
session.EXPECT().AcceptUniStream(gomock.Any()).DoAndReturn(func(context.Context) (quic.ReceiveStream, error) {
<-closed
return nil, errors.New("test done")
}).MaxTimes(1)
session.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).Do(func(quic.ErrorCode, string) { close(closed) })
_, err = rt.RoundTrip(req)
Expect(err).To(MatchError(testErr))
@ -139,6 +143,10 @@ var _ = Describe("RoundTripper", func() {
session.EXPECT().OpenUniStream().AnyTimes().Return(nil, testErr)
session.EXPECT().HandshakeComplete().Return(handshakeCtx).Times(2)
session.EXPECT().OpenStreamSync(context.Background()).Return(nil, testErr).Times(2)
session.EXPECT().AcceptUniStream(gomock.Any()).DoAndReturn(func(context.Context) (quic.ReceiveStream, error) {
<-closed
return nil, errors.New("test done")
}).MaxTimes(1)
session.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).Do(func(quic.ErrorCode, string) { close(closed) })
req, err := http.NewRequest("GET", "https://quic.clemente.io/file1.html", nil)
Expect(err).ToNot(HaveOccurred())