Repository: quic-go/quic-go
Pull request #5149 (2025-05-23 05:43:47)

convert Stream interface to a struct
Part of #5148.


Patch:
diff --git a/connection.go b/connection.go
index 8a0947f5..78482a72 100644
--- a/connection.go
+++ b/connection.go
@@ -33,11 +33,11 @@ type unpacker interface {
 type streamManager interface {
 	GetOrOpenSendStream(protocol.StreamID) (sendStreamI, error)
 	GetOrOpenReceiveStream(protocol.StreamID) (receiveStreamI, error)
-	OpenStream() (Stream, error)
+	OpenStream() (*Stream, error)
 	OpenUniStream() (SendStream, error)
-	OpenStreamSync(context.Context) (Stream, error)
+	OpenStreamSync(context.Context) (*Stream, error)
 	OpenUniStreamSync(context.Context) (SendStream, error)
-	AcceptStream(context.Context) (Stream, error)
+	AcceptStream(context.Context) (*Stream, error)
 	AcceptUniStream(context.Context) (ReceiveStream, error)
 	DeleteStream(protocol.StreamID) error
 	UpdateLimits(*wire.TransportParameters)
@@ -2492,7 +2492,7 @@ func (s *connection) maxPacketSize() protocol.ByteCount {
 }
 
 // AcceptStream returns the next stream openend by the peer
-func (s *connection) AcceptStream(ctx context.Context) (Stream, error) {
+func (s *connection) AcceptStream(ctx context.Context) (*Stream, error) {
 	return s.streamsMap.AcceptStream(ctx)
 }
 
@@ -2501,11 +2501,11 @@ func (s *connection) AcceptUniStream(ctx context.Context) (ReceiveStream, error)
 }
 
 // OpenStream opens a stream
-func (s *connection) OpenStream() (Stream, error) {
+func (s *connection) OpenStream() (*Stream, error) {
 	return s.streamsMap.OpenStream()
 }
 
-func (s *connection) OpenStreamSync(ctx context.Context) (Stream, error) {
+func (s *connection) OpenStreamSync(ctx context.Context) (*Stream, error) {
 	return s.streamsMap.OpenStreamSync(ctx)
 }
 
diff --git a/http3/client.go b/http3/client.go
index 019c4d4f..6bd880cf 100644
--- a/http3/client.go
+++ b/http3/client.go
@@ -83,7 +83,7 @@ func newClientConn(
 	conn quic.Connection,
 	enableDatagrams bool,
 	additionalSettings map[uint64]uint64,
-	streamHijacker func(FrameType, quic.ConnectionTracingID, quic.Stream, error) (hijacked bool, err error),
+	streamHijacker func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error),
 	uniStreamHijacker func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool),
 	maxResponseHeaderBytes int64,
 	disableCompression bool,
@@ -145,7 +145,7 @@ func (c *ClientConn) setupConn() error {
 	return err
 }
 
-func (c *ClientConn) handleBidirectionalStreams(streamHijacker func(FrameType, quic.ConnectionTracingID, quic.Stream, error) (hijacked bool, err error)) {
+func (c *ClientConn) handleBidirectionalStreams(streamHijacker func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error)) {
 	for {
 		str, err := c.AcceptStream(context.Background())
 		if err != nil {
diff --git a/http3/conn.go b/http3/conn.go
index 6594766b..3b94c550 100644
--- a/http3/conn.go
+++ b/http3/conn.go
@@ -28,8 +28,8 @@ var errGoAway = errors.New("connection in graceful shutdown")
 // It has all methods from the quic.Connection expect for AcceptStream, AcceptUniStream,
 // SendDatagram and ReceiveDatagram.
 type Connection interface {
-	OpenStream() (quic.Stream, error)
-	OpenStreamSync(context.Context) (quic.Stream, error)
+	OpenStream() (*quic.Stream, error)
+	OpenStreamSync(context.Context) (*quic.Stream, error)
 	OpenUniStream() (quic.SendStream, error)
 	OpenUniStreamSync(context.Context) (quic.SendStream, error)
 	LocalAddr() net.Addr
@@ -122,21 +122,19 @@ func (c *connection) openRequestStream(
 	disableCompression bool,
 	maxHeaderBytes uint64,
 ) (*RequestStream, error) {
-	if c.perspective == protocol.PerspectiveClient {
-		c.streamMx.Lock()
-		maxStreamID := c.maxStreamID
-		var nextStreamID quic.StreamID
-		if c.lastStreamID == protocol.InvalidStreamID {
-			nextStreamID = 0
-		} else {
-			nextStreamID = c.lastStreamID + 4
-		}
-		c.streamMx.Unlock()
-		// Streams with stream ID equal to or greater than the stream ID carried in the GOAWAY frame
-		// will be rejected, see section 5.2 of RFC 9114.
-		if maxStreamID != protocol.InvalidStreamID && nextStreamID >= maxStreamID {
-			return nil, errGoAway
-		}
+	c.streamMx.Lock()
+	maxStreamID := c.maxStreamID
+	var nextStreamID quic.StreamID
+	if c.lastStreamID == protocol.InvalidStreamID {
+		nextStreamID = 0
+	} else {
+		nextStreamID = c.lastStreamID + 4
+	}
+	c.streamMx.Unlock()
+	// Streams with stream ID equal to or greater than the stream ID carried in the GOAWAY frame
+	// will be rejected, see section 5.2 of RFC 9114.
+	if maxStreamID != protocol.InvalidStreamID && nextStreamID >= maxStreamID {
+		return nil, errGoAway
 	}
 
 	str, err := c.OpenStreamSync(ctx)
diff --git a/http3/server.go b/http3/server.go
index c5a0fda9..fc1ebede 100644
--- a/http3/server.go
+++ b/http3/server.go
@@ -156,7 +156,7 @@ type Server struct {
 	// Callers can either ignore the frame and return control of the stream back to HTTP/3
 	// (by returning hijacked false).
 	// Alternatively, callers can take over the QUIC stream (by returning hijacked true).
-	StreamHijacker func(FrameType, quic.ConnectionTracingID, quic.Stream, error) (hijacked bool, err error)
+	StreamHijacker func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error)
 
 	// UniStreamHijacker, when set, is called for unknown unidirectional stream of unknown stream type.
 	// If parsing the stream type fails, the error is passed to the callback.
@@ -557,7 +557,7 @@ func (s *Server) handleRequest(conn *connection, str datagramStream, decoder *qp
 			return s.StreamHijacker(
 				ft,
 				conn.Context().Value(quic.ConnectionTracingKey).(quic.ConnectionTracingID),
-				str,
+				str.QUICStream(),
 				e,
 			)
 		}
diff --git a/http3/state_tracking_stream.go b/http3/state_tracking_stream.go
index a5888099..6c7fa52d 100644
--- a/http3/state_tracking_stream.go
+++ b/http3/state_tracking_stream.go
@@ -19,7 +19,7 @@ const streamDatagramQueueLen = 32
 // parent connection, this is done through the streamClearer interface when
 // both the send and receive sides are closed
 type stateTrackingStream struct {
-	quic.Stream
+	*quic.Stream
 
 	sendDatagram func([]byte) error
 	hasData      chan struct{}
@@ -32,16 +32,13 @@ type stateTrackingStream struct {
 	clearer streamClearer
 }
 
-var (
-	_ datagramStream = &stateTrackingStream{}
-	_ quic.Stream    = &stateTrackingStream{}
-)
+var _ datagramStream = &stateTrackingStream{}
 
 type streamClearer interface {
 	clearStream(quic.StreamID)
 }
 
-func newStateTrackingStream(s quic.Stream, clearer streamClearer, sendDatagram func([]byte) error) *stateTrackingStream {
+func newStateTrackingStream(s *quic.Stream, clearer streamClearer, sendDatagram func([]byte) error) *stateTrackingStream {
 	t := &stateTrackingStream{
 		Stream:       s,
 		clearer:      clearer,
@@ -170,3 +167,7 @@ start:
 	}
 	goto start
 }
+
+func (s *stateTrackingStream) QUICStream() *quic.Stream {
+	return s.Stream
+}
diff --git a/http3/http_stream.go b/http3/stream.go
similarity index 97%
rename from http3/http_stream.go
rename to http3/stream.go
index f52f5e1f..05f3c108 100644
--- a/http3/http_stream.go
+++ b/http3/stream.go
@@ -7,6 +7,7 @@ import (
 	"io"
 	"net/http"
 	"net/http/httptrace"
+	"time"
 
 	"github.com/quic-go/quic-go"
 	"github.com/quic-go/quic-go/internal/protocol"
@@ -15,9 +16,17 @@ import (
 )
 
 type datagramStream interface {
-	quic.Stream
+	io.ReadWriteCloser
+	CancelRead(quic.StreamErrorCode)
+	CancelWrite(quic.StreamErrorCode)
+	StreamID() quic.StreamID
+	Context() context.Context
+	SetReadDeadline(time.Time) error
+	SetWriteDeadline(time.Time) error
 	SendDatagram(b []byte) error
 	ReceiveDatagram(ctx context.Context) ([]byte, error)
+
+	QUICStream() *quic.Stream
 }
 
 // A Stream is an HTTP/3 request stream.
diff --git a/http3/http_stream_test.go b/http3/stream_test.go
similarity index 100%
rename from http3/http_stream_test.go
rename to http3/stream_test.go
diff --git a/http3/transport.go b/http3/transport.go
index 6f876063..042cded2 100644
--- a/http3/transport.go
+++ b/http3/transport.go
@@ -98,7 +98,7 @@ type Transport struct {
 	// However, if the user explicitly requested gzip it is not automatically uncompressed.
 	DisableCompression bool
 
-	StreamHijacker    func(FrameType, quic.ConnectionTracingID, quic.Stream, error) (hijacked bool, err error)
+	StreamHijacker    func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error)
 	UniStreamHijacker func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool)
 
 	Logger *slog.Logger
diff --git a/interface.go b/interface.go
index 99dd9e2e..c149d068 100644
--- a/interface.go
+++ b/interface.go
@@ -70,18 +70,6 @@ type connTracingCtxKey struct{}
 // context returned by tls.Config.ClientInfo.Context.
 var QUICVersionContextKey = handshake.QUICVersionContextKey
 
-// Stream is the interface implemented by QUIC streams.
-// In addition to the errors listed on the [Connection],
-// calls to stream functions can return a [StreamError] if the stream is canceled.
-type Stream interface {
-	ReceiveStream
-	SendStream
-	// SetDeadline sets the read and write deadlines associated
-	// with the connection. It is equivalent to calling both
-	// SetReadDeadline and SetWriteDeadline.
-	SetDeadline(t time.Time) error
-}
-
 // A ReceiveStream is a unidirectional Receive Stream.
 type ReceiveStream interface {
 	// StreamID returns the stream ID.
@@ -145,7 +133,7 @@ type SendStream interface {
 //   - [VersionNegotiationError]: returned by the client, when there's no version overlap between the peers
 type Connection interface {
 	// AcceptStream returns the next stream opened by the peer, blocking until one is available.
-	AcceptStream(context.Context) (Stream, error)
+	AcceptStream(context.Context) (*Stream, error)
 	// AcceptUniStream returns the next unidirectional stream opened by the peer, blocking until one is available.
 	AcceptUniStream(context.Context) (ReceiveStream, error)
 	// OpenStream opens a new bidirectional QUIC stream.
@@ -154,13 +142,13 @@ type Connection interface {
 	// or the stream has been reset or closed.
 	// When reaching the peer's stream limit, it is not possible to open a new stream until the
 	// peer raises the stream limit. In that case, a StreamLimitReachedError is returned.
-	OpenStream() (Stream, error)
+	OpenStream() (*Stream, error)
 	// OpenStreamSync opens a new bidirectional QUIC stream.
 	// It blocks until a new stream can be opened.
 	// There is no signaling to the peer about new streams:
 	// The peer can only accept the stream after data has been sent on the stream,
 	// or the stream has been reset or closed.
-	OpenStreamSync(context.Context) (Stream, error)
+	OpenStreamSync(context.Context) (*Stream, error)
 	// OpenUniStream opens a new outgoing unidirectional QUIC stream.
 	// There is no signaling to the peer about new streams:
 	// The peer can only accept the stream after data has been sent on the stream,
diff --git a/interop/http09/server.go b/interop/http09/server.go
index 07ac9e11..51122646 100644
--- a/interop/http09/server.go
+++ b/interop/http09/server.go
@@ -61,7 +61,7 @@ func (s *Server) handleConn(conn quic.Connection) {
 	}
 }
 
-func (s *Server) handleStream(str quic.Stream) error {
+func (s *Server) handleStream(str *quic.Stream) error {
 	reqBytes, err := io.ReadAll(str)
 	if err != nil {
 		return err
diff --git a/mockgen.go b/mockgen.go
index f46c2049..8ba31825 100644
--- a/mockgen.go
+++ b/mockgen.go
@@ -11,9 +11,6 @@ type RawConn = rawConn
 //go:generate sh -c "go run go.uber.org/mock/mockgen -typed -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_sender_test.go github.com/quic-go/quic-go Sender"
 type Sender = sender
 
-//go:generate sh -c "go run go.uber.org/mock/mockgen -typed -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_internal_test.go github.com/quic-go/quic-go StreamI"
-type StreamI = streamI
-
 //go:generate sh -c "go run go.uber.org/mock/mockgen -typed -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_receive_stream_internal_test.go github.com/quic-go/quic-go ReceiveStreamI"
 type ReceiveStreamI = receiveStreamI
 
diff --git a/stream.go b/stream.go
index 9cd2695d..3f979d17 100644
--- a/stream.go
+++ b/stream.go
@@ -10,7 +10,6 @@ import (
 	"github.com/quic-go/quic-go/internal/ackhandler"
 	"github.com/quic-go/quic-go/internal/flowcontrol"
 	"github.com/quic-go/quic-go/internal/protocol"
-	"github.com/quic-go/quic-go/internal/wire"
 )
 
 type deadlineError struct{}
@@ -49,28 +48,7 @@ func (s *uniStreamSender) onHasStreamControlFrame(id protocol.StreamID, str stre
 
 var _ streamSender = &uniStreamSender{}
 
-type streamI interface {
-	Stream
-	closeForShutdown(error)
-	// for receiving
-	handleStreamFrame(*wire.StreamFrame, time.Time) error
-	handleResetStreamFrame(*wire.ResetStreamFrame, time.Time) error
-	// for sending
-	hasData() bool
-	handleStopSendingFrame(*wire.StopSendingFrame)
-	popStreamFrame(protocol.ByteCount, protocol.Version) (_ ackhandler.StreamFrame, _ *wire.StreamDataBlockedFrame, hasMore bool)
-	updateSendWindow(protocol.ByteCount)
-}
-
-var (
-	_ receiveStreamI = (streamI)(nil)
-	_ sendStreamI    = (streamI)(nil)
-)
-
-// A Stream assembles the data from StreamFrames and provides a super-convenient Read-Interface
-//
-// Read() and Write() may be called concurrently, but multiple calls to Read() or Write() individually must be synchronized manually.
-type stream struct {
+type Stream struct {
 	receiveStream
 	sendStream
 
@@ -80,10 +58,7 @@ type stream struct {
 	sendStreamCompleted    bool
 }
 
-var (
-	_ Stream                   = &stream{}
-	_ streamControlFrameGetter = &receiveStream{}
-)
+var _ streamControlFrameGetter = &receiveStream{}
 
 // newStream creates a new Stream
 func newStream(
@@ -91,8 +66,8 @@ func newStream(
 	streamID protocol.StreamID,
 	sender streamSender,
 	flowController flowcontrol.StreamFlowController,
-) *stream {
-	s := &stream{sender: sender}
+) *Stream {
+	s := &Stream{sender: sender}
 	senderForSendStream := &uniStreamSender{
 		streamSender: sender,
 		onStreamCompletedImpl: func() {
@@ -123,16 +98,16 @@ func newStream(
 }
 
 // need to define StreamID() here, since both receiveStream and readStream have a StreamID()
-func (s *stream) StreamID() protocol.StreamID {
+func (s *Stream) StreamID() protocol.StreamID {
 	// the result is same for receiveStream and sendStream
 	return s.sendStream.StreamID()
 }
 
-func (s *stream) Close() error {
+func (s *Stream) Close() error {
 	return s.sendStream.Close()
 }
 
-func (s *stream) getControlFrame(now time.Time) (_ ackhandler.Frame, ok, hasMore bool) {
+func (s *Stream) getControlFrame(now time.Time) (_ ackhandler.Frame, ok, hasMore bool) {
 	f, ok, _ := s.sendStream.getControlFrame(now)
 	if ok {
 		return f, true, true
@@ -140,7 +115,7 @@ func (s *stream) getControlFrame(now time.Time) (_ ackhandler.Frame, ok, hasMore
 	return s.receiveStream.getControlFrame(now)
 }
 
-func (s *stream) SetDeadline(t time.Time) error {
+func (s *Stream) SetDeadline(t time.Time) error {
 	_ = s.SetReadDeadline(t)  // SetReadDeadline never errors
 	_ = s.SetWriteDeadline(t) // SetWriteDeadline never errors
 	return nil
@@ -149,14 +124,14 @@ func (s *stream) SetDeadline(t time.Time) error {
 // CloseForShutdown closes a stream abruptly.
 // It makes Read and Write unblock (and return the error) immediately.
 // The peer will NOT be informed about this: the stream is closed without sending a FIN or RST.
-func (s *stream) closeForShutdown(err error) {
+func (s *Stream) closeForShutdown(err error) {
 	s.sendStream.closeForShutdown(err)
 	s.receiveStream.closeForShutdown(err)
 }
 
 // checkIfCompleted is called from the uniStreamSender, when one of the stream halves is completed.
 // It makes sure that the onStreamCompleted callback is only called if both receive and send side have completed.
-func (s *stream) checkIfCompleted() {
+func (s *Stream) checkIfCompleted() {
 	if s.sendStreamCompleted && s.receiveStreamCompleted {
 		s.sender.onStreamCompleted(s.StreamID())
 	}
diff --git a/streams_map.go b/streams_map.go
index 510b3e59..186d4e6b 100644
--- a/streams_map.go
+++ b/streams_map.go
@@ -51,9 +51,9 @@ type streamsMap struct {
 	newFlowController func(protocol.StreamID) flowcontrol.StreamFlowController
 
 	mutex               sync.Mutex
-	outgoingBidiStreams *outgoingStreamsMap[streamI]
+	outgoingBidiStreams *outgoingStreamsMap[*Stream]
 	outgoingUniStreams  *outgoingStreamsMap[sendStreamI]
-	incomingBidiStreams *incomingStreamsMap[streamI]
+	incomingBidiStreams *incomingStreamsMap[*Stream]
 	incomingUniStreams  *incomingStreamsMap[receiveStreamI]
 	reset               bool
 }
@@ -85,7 +85,7 @@ func newStreamsMap(
 func (m *streamsMap) initMaps() {
 	m.outgoingBidiStreams = newOutgoingStreamsMap(
 		protocol.StreamTypeBidi,
-		func(num protocol.StreamNum) streamI {
+		func(num protocol.StreamNum) *Stream {
 			id := num.StreamID(protocol.StreamTypeBidi, m.perspective)
 			return newStream(m.ctx, id, m.sender, m.newFlowController(id))
 		},
@@ -93,7 +93,7 @@ func (m *streamsMap) initMaps() {
 	)
 	m.incomingBidiStreams = newIncomingStreamsMap(
 		protocol.StreamTypeBidi,
-		func(num protocol.StreamNum) streamI {
+		func(num protocol.StreamNum) *Stream {
 			id := num.StreamID(protocol.StreamTypeBidi, m.perspective.Opposite())
 			return newStream(m.ctx, id, m.sender, m.newFlowController(id))
 		},
@@ -119,7 +119,7 @@ func (m *streamsMap) initMaps() {
 	)
 }
 
-func (m *streamsMap) OpenStream() (Stream, error) {
+func (m *streamsMap) OpenStream() (*Stream, error) {
 	m.mutex.Lock()
 	reset := m.reset
 	mm := m.outgoingBidiStreams
@@ -131,7 +131,7 @@ func (m *streamsMap) OpenStream() (Stream, error) {
 	return str, convertStreamError(err, protocol.StreamTypeBidi, m.perspective)
 }
 
-func (m *streamsMap) OpenStreamSync(ctx context.Context) (Stream, error) {
+func (m *streamsMap) OpenStreamSync(ctx context.Context) (*Stream, error) {
 	m.mutex.Lock()
 	reset := m.reset
 	mm := m.outgoingBidiStreams
@@ -167,7 +167,7 @@ func (m *streamsMap) OpenUniStreamSync(ctx context.Context) (SendStream, error)
 	return str, convertStreamError(err, protocol.StreamTypeUni, m.perspective)
 }
 
-func (m *streamsMap) AcceptStream(ctx context.Context) (Stream, error) {
+func (m *streamsMap) AcceptStream(ctx context.Context) (*Stream, error) {
 	m.mutex.Lock()
 	reset := m.reset
 	mm := m.incomingBidiStreams
@@ -230,14 +230,19 @@ func (m *streamsMap) getOrOpenReceiveStream(id protocol.StreamID) (receiveStream
 		str, err := m.incomingUniStreams.GetOrOpenStream(num)
 		return str, convertStreamError(err, protocol.StreamTypeUni, m.perspective)
 	case protocol.StreamTypeBidi:
-		var str receiveStreamI
-		var err error
 		if id.InitiatedBy() == m.perspective {
-			str, err = m.outgoingBidiStreams.GetStream(num)
+			str, err := m.outgoingBidiStreams.GetStream(num)
+			if str == nil && err == nil {
+				return nil, nil
+			}
+			return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 		} else {
-			str, err = m.incomingBidiStreams.GetOrOpenStream(num)
+			str, err := m.incomingBidiStreams.GetOrOpenStream(num)
+			if str == nil && err == nil {
+				return nil, nil
+			}
+			return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 		}
-		return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 	}
 	panic("")
 }
@@ -264,14 +269,19 @@ func (m *streamsMap) getOrOpenSendStream(id protocol.StreamID) (sendStreamI, err
 		// an incoming unidirectional stream is a receive stream, not a send stream
 		return nil, fmt.Errorf("peer attempted to open send stream %d", id)
 	case protocol.StreamTypeBidi:
-		var str sendStreamI
-		var err error
 		if id.InitiatedBy() == m.perspective {
-			str, err = m.outgoingBidiStreams.GetStream(num)
+			str, err := m.outgoingBidiStreams.GetStream(num)
+			if str == nil && err == nil {
+				return nil, nil
+			}
+			return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 		} else {
-			str, err = m.incomingBidiStreams.GetOrOpenStream(num)
+			str, err := m.incomingBidiStreams.GetOrOpenStream(num)
+			if str == nil && err == nil {
+				return nil, nil
+			}
+			return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 		}
-		return str, convertStreamError(err, protocol.StreamTypeBidi, id.InitiatedBy())
 	}
 	panic("")
 }


Test patch:
diff --git a/connection_test.go b/connection_test.go
index 085549b6..1ed8c0c1 100644
--- a/connection_test.go
+++ b/connection_test.go
@@ -363,7 +363,7 @@ func TestConnectionOpenStreams(t *testing.T) {
 	tc := newServerTestConnection(t, mockCtrl, nil, false, connectionOptStreamManager(streamsMap))
 
 	// using OpenStream
-	mstr := NewMockStreamI(mockCtrl)
+	mstr := &Stream{}
 	streamsMap.EXPECT().OpenStream().Return(mstr, nil)
 	str, err := tc.conn.OpenStream()
 	require.NoError(t, err)
@@ -396,7 +396,7 @@ func TestConnectionAcceptStreams(t *testing.T) {
 	// bidirectional streams
 	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
 	defer cancel()
-	mstr := NewMockStreamI(mockCtrl)
+	mstr := &Stream{}
 	streamsMap.EXPECT().AcceptStream(ctx).Return(mstr, nil)
 	str, err := tc.conn.AcceptStream(ctx)
 	require.NoError(t, err)
diff --git a/http3/client_test.go b/http3/client_test.go
index d65c4f53..2e96e45a 100644
--- a/http3/client_test.go
+++ b/http3/client_test.go
@@ -526,7 +526,7 @@ func testClientStreamHijacking(t *testing.T, bidirectional, doHijack bool, strea
 	tr := &Transport{}
 	switch bidirectional {
 	case true:
-		tr.StreamHijacker = func(ft FrameType, id quic.ConnectionTracingID, _ quic.Stream, e error) (hijacked bool, err error) {
+		tr.StreamHijacker = func(ft FrameType, id quic.ConnectionTracingID, _ *quic.Stream, e error) (hijacked bool, err error) {
 			hijackChan <- hijackCall{ft: ft, connTracingID: id, e: e}
 			if !doHijack {
 				return false, errors.New("not hijacking")
diff --git a/http3/conn_test.go b/http3/conn_test.go
index 34f9fdf8..25fa7118 100644
--- a/http3/conn_test.go
+++ b/http3/conn_test.go
@@ -268,7 +268,7 @@ func testConnGoAway(t *testing.T, withStream bool) {
 	b = (&settingsFrame{}).Append(b)
 	b = (&goAwayFrame{StreamID: 8}).Append(b)
 
-	var str quic.Stream
+	var str *RequestStream
 	if withStream {
 		s, err := conn.openRequestStream(context.Background(), nil, nil, true, 1000)
 		require.NoError(t, err)
diff --git a/http3/mock_datagram_stream_test.go b/http3/mock_datagram_stream_test.go
index faaab993..7ca0ae63 100644
--- a/http3/mock_datagram_stream_test.go
+++ b/http3/mock_datagram_stream_test.go
@@ -190,6 +190,44 @@ func (c *MockDatagramStreamContextCall) DoAndReturn(f func() context.Context) *M
 	return c
 }
 
+// QUICStream mocks base method.
+func (m *MockDatagramStream) QUICStream() *quic.Stream {
+	m.ctrl.T.Helper()
+	ret := m.ctrl.Call(m, "QUICStream")
+	ret0, _ := ret[0].(*quic.Stream)
+	return ret0
+}
+
+// QUICStream indicates an expected call of QUICStream.
+func (mr *MockDatagramStreamMockRecorder) QUICStream() *MockDatagramStreamQUICStreamCall {
+	mr.mock.ctrl.T.Helper()
+	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QUICStream", reflect.TypeOf((*MockDatagramStream)(nil).QUICStream))
+	return &MockDatagramStreamQUICStreamCall{Call: call}
+}
+
+// MockDatagramStreamQUICStreamCall wrap *gomock.Call
+type MockDatagramStreamQUICStreamCall struct {
+	*gomock.Call
+}
+
+// Return rewrite *gomock.Call.Return
+func (c *MockDatagramStreamQUICStreamCall) Return(arg0 *quic.Stream) *MockDatagramStreamQUICStreamCall {
+	c.Call = c.Call.Return(arg0)
+	return c
+}
+
+// Do rewrite *gomock.Call.Do
+func (c *MockDatagramStreamQUICStreamCall) Do(f func() *quic.Stream) *MockDatagramStreamQUICStreamCall {
+	c.Call = c.Call.Do(f)
+	return c
+}
+
+// DoAndReturn rewrite *gomock.Call.DoAndReturn
+func (c *MockDatagramStreamQUICStreamCall) DoAndReturn(f func() *quic.Stream) *MockDatagramStreamQUICStreamCall {
+	c.Call = c.Call.DoAndReturn(f)
+	return c
+}
+
 // Read mocks base method.
 func (m *MockDatagramStream) Read(p []byte) (int, error) {
 	m.ctrl.T.Helper()
@@ -306,56 +344,18 @@ func (c *MockDatagramStreamSendDatagramCall) DoAndReturn(f func([]byte) error) *
 	return c
 }
 
-// SetDeadline mocks base method.
-func (m *MockDatagramStream) SetDeadline(t time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetDeadline", t)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// SetDeadline indicates an expected call of SetDeadline.
-func (mr *MockDatagramStreamMockRecorder) SetDeadline(t any) *MockDatagramStreamSetDeadlineCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockDatagramStream)(nil).SetDeadline), t)
-	return &MockDatagramStreamSetDeadlineCall{Call: call}
-}
-
-// MockDatagramStreamSetDeadlineCall wrap *gomock.Call
-type MockDatagramStreamSetDeadlineCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockDatagramStreamSetDeadlineCall) Return(arg0 error) *MockDatagramStreamSetDeadlineCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockDatagramStreamSetDeadlineCall) Do(f func(time.Time) error) *MockDatagramStreamSetDeadlineCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockDatagramStreamSetDeadlineCall) DoAndReturn(f func(time.Time) error) *MockDatagramStreamSetDeadlineCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
 // SetReadDeadline mocks base method.
-func (m *MockDatagramStream) SetReadDeadline(t time.Time) error {
+func (m *MockDatagramStream) SetReadDeadline(arg0 time.Time) error {
 	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetReadDeadline", t)
+	ret := m.ctrl.Call(m, "SetReadDeadline", arg0)
 	ret0, _ := ret[0].(error)
 	return ret0
 }
 
 // SetReadDeadline indicates an expected call of SetReadDeadline.
-func (mr *MockDatagramStreamMockRecorder) SetReadDeadline(t any) *MockDatagramStreamSetReadDeadlineCall {
+func (mr *MockDatagramStreamMockRecorder) SetReadDeadline(arg0 any) *MockDatagramStreamSetReadDeadlineCall {
 	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockDatagramStream)(nil).SetReadDeadline), t)
+	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockDatagramStream)(nil).SetReadDeadline), arg0)
 	return &MockDatagramStreamSetReadDeadlineCall{Call: call}
 }
 
@@ -383,17 +383,17 @@ func (c *MockDatagramStreamSetReadDeadlineCall) DoAndReturn(f func(time.Time) er
 }
 
 // SetWriteDeadline mocks base method.
-func (m *MockDatagramStream) SetWriteDeadline(t time.Time) error {
+func (m *MockDatagramStream) SetWriteDeadline(arg0 time.Time) error {
 	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetWriteDeadline", t)
+	ret := m.ctrl.Call(m, "SetWriteDeadline", arg0)
 	ret0, _ := ret[0].(error)
 	return ret0
 }
 
 // SetWriteDeadline indicates an expected call of SetWriteDeadline.
-func (mr *MockDatagramStreamMockRecorder) SetWriteDeadline(t any) *MockDatagramStreamSetWriteDeadlineCall {
+func (mr *MockDatagramStreamMockRecorder) SetWriteDeadline(arg0 any) *MockDatagramStreamSetWriteDeadlineCall {
 	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockDatagramStream)(nil).SetWriteDeadline), t)
+	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockDatagramStream)(nil).SetWriteDeadline), arg0)
 	return &MockDatagramStreamSetWriteDeadlineCall{Call: call}
 }
 
diff --git a/http3/server_test.go b/http3/server_test.go
index 7daf1fb9..4e1de313 100644
--- a/http3/server_test.go
+++ b/http3/server_test.go
@@ -492,7 +492,7 @@ func testServerHijackBidirectionalStream(t *testing.T, bidirectional bool, doHij
 	hijackChan := make(chan hijackCall, 1)
 	testDone := make(chan struct{})
 	s := &Server{
-		StreamHijacker: func(ft FrameType, connTracingID quic.ConnectionTracingID, _ quic.Stream, e error) (hijacked bool, err error) {
+		StreamHijacker: func(ft FrameType, connTracingID quic.ConnectionTracingID, _ *quic.Stream, e error) (hijacked bool, err error) {
 			defer close(testDone)
 			hijackChan <- hijackCall{ft: ft, connTracingID: connTracingID, e: e}
 			return doHijack, hijackErr
diff --git a/http3/state_tracking_stream_test.go b/http3/state_tracking_stream_test.go
index fcd7bc7c..b98c1d88 100644
--- a/http3/state_tracking_stream_test.go
+++ b/http3/state_tracking_stream_test.go
@@ -14,7 +14,7 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func newStreamPair(t *testing.T) (client, server quic.Stream) {
+func newStreamPair(t *testing.T) (client, server *quic.Stream) {
 	t.Helper()
 
 	clientConn, serverConn := newConnPair(t)
diff --git a/integrationtests/self/cancelation_test.go b/integrationtests/self/cancelation_test.go
index 8310f471..98766645 100644
--- a/integrationtests/self/cancelation_test.go
+++ b/integrationtests/self/cancelation_test.go
@@ -526,7 +526,7 @@ func TestHeavyStreamCancellation(t *testing.T) {
 	serverConn, err := server.Accept(context.Background())
 	require.NoError(t, err)
 
-	handleStream := func(str quic.Stream) {
+	handleStream := func(str *quic.Stream) {
 		str.SetDeadline(time.Now().Add(time.Second))
 		go func() {
 			defer wg.Done()
diff --git a/integrationtests/self/deadline_test.go b/integrationtests/self/deadline_test.go
index 1892647e..ed577f4d 100644
--- a/integrationtests/self/deadline_test.go
+++ b/integrationtests/self/deadline_test.go
@@ -14,7 +14,7 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func setupDeadlineTest(t *testing.T) (serverStr, clientStr quic.Stream) {
+func setupDeadlineTest(t *testing.T) (serverStr, clientStr *quic.Stream) {
 	t.Helper()
 	server, err := quic.Listen(newUDPConnLocalhost(t), getTLSConfig(), getQuicConfig(nil))
 	require.NoError(t, err)
diff --git a/mock_quic_conn_test.go b/mock_quic_conn_test.go
index a3884b02..2eb5590d 100644
--- a/mock_quic_conn_test.go
+++ b/mock_quic_conn_test.go
@@ -42,10 +42,10 @@ func (m *MockQUICConn) EXPECT() *MockQUICConnMockRecorder {
 }
 
 // AcceptStream mocks base method.
-func (m *MockQUICConn) AcceptStream(arg0 context.Context) (Stream, error) {
+func (m *MockQUICConn) AcceptStream(arg0 context.Context) (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "AcceptStream", arg0)
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -63,19 +63,19 @@ type MockQUICConnAcceptStreamCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockQUICConnAcceptStreamCall) Return(arg0 Stream, arg1 error) *MockQUICConnAcceptStreamCall {
+func (c *MockQUICConnAcceptStreamCall) Return(arg0 *Stream, arg1 error) *MockQUICConnAcceptStreamCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockQUICConnAcceptStreamCall) Do(f func(context.Context) (Stream, error)) *MockQUICConnAcceptStreamCall {
+func (c *MockQUICConnAcceptStreamCall) Do(f func(context.Context) (*Stream, error)) *MockQUICConnAcceptStreamCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockQUICConnAcceptStreamCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockQUICConnAcceptStreamCall {
+func (c *MockQUICConnAcceptStreamCall) DoAndReturn(f func(context.Context) (*Stream, error)) *MockQUICConnAcceptStreamCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
@@ -388,10 +388,10 @@ func (c *MockQUICConnNextConnectionCall) DoAndReturn(f func(context.Context) (Co
 }
 
 // OpenStream mocks base method.
-func (m *MockQUICConn) OpenStream() (Stream, error) {
+func (m *MockQUICConn) OpenStream() (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "OpenStream")
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -409,28 +409,28 @@ type MockQUICConnOpenStreamCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockQUICConnOpenStreamCall) Return(arg0 Stream, arg1 error) *MockQUICConnOpenStreamCall {
+func (c *MockQUICConnOpenStreamCall) Return(arg0 *Stream, arg1 error) *MockQUICConnOpenStreamCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockQUICConnOpenStreamCall) Do(f func() (Stream, error)) *MockQUICConnOpenStreamCall {
+func (c *MockQUICConnOpenStreamCall) Do(f func() (*Stream, error)) *MockQUICConnOpenStreamCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockQUICConnOpenStreamCall) DoAndReturn(f func() (Stream, error)) *MockQUICConnOpenStreamCall {
+func (c *MockQUICConnOpenStreamCall) DoAndReturn(f func() (*Stream, error)) *MockQUICConnOpenStreamCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
 
 // OpenStreamSync mocks base method.
-func (m *MockQUICConn) OpenStreamSync(arg0 context.Context) (Stream, error) {
+func (m *MockQUICConn) OpenStreamSync(arg0 context.Context) (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "OpenStreamSync", arg0)
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -448,19 +448,19 @@ type MockQUICConnOpenStreamSyncCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockQUICConnOpenStreamSyncCall) Return(arg0 Stream, arg1 error) *MockQUICConnOpenStreamSyncCall {
+func (c *MockQUICConnOpenStreamSyncCall) Return(arg0 *Stream, arg1 error) *MockQUICConnOpenStreamSyncCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockQUICConnOpenStreamSyncCall) Do(f func(context.Context) (Stream, error)) *MockQUICConnOpenStreamSyncCall {
+func (c *MockQUICConnOpenStreamSyncCall) Do(f func(context.Context) (*Stream, error)) *MockQUICConnOpenStreamSyncCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockQUICConnOpenStreamSyncCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockQUICConnOpenStreamSyncCall {
+func (c *MockQUICConnOpenStreamSyncCall) DoAndReturn(f func(context.Context) (*Stream, error)) *MockQUICConnOpenStreamSyncCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
diff --git a/mock_stream_internal_test.go b/mock_stream_internal_test.go
deleted file mode 100644
index 2136bdc3..00000000
--- a/mock_stream_internal_test.go
+++ /dev/null
@@ -1,685 +0,0 @@
-// Code generated by MockGen. DO NOT EDIT.
-// Source: github.com/quic-go/quic-go (interfaces: StreamI)
-//
-// Generated by this command:
-//
-//	mockgen -typed -build_flags=-tags=gomock -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_internal_test.go github.com/quic-go/quic-go StreamI
-//
-
-// Package quic is a generated GoMock package.
-package quic
-
-import (
-	context "context"
-	reflect "reflect"
-	time "time"
-
-	ackhandler "github.com/quic-go/quic-go/internal/ackhandler"
-	protocol "github.com/quic-go/quic-go/internal/protocol"
-	wire "github.com/quic-go/quic-go/internal/wire"
-	gomock "go.uber.org/mock/gomock"
-)
-
-// MockStreamI is a mock of StreamI interface.
-type MockStreamI struct {
-	ctrl     *gomock.Controller
-	recorder *MockStreamIMockRecorder
-	isgomock struct{}
-}
-
-// MockStreamIMockRecorder is the mock recorder for MockStreamI.
-type MockStreamIMockRecorder struct {
-	mock *MockStreamI
-}
-
-// NewMockStreamI creates a new mock instance.
-func NewMockStreamI(ctrl *gomock.Controller) *MockStreamI {
-	mock := &MockStreamI{ctrl: ctrl}
-	mock.recorder = &MockStreamIMockRecorder{mock}
-	return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use.
-func (m *MockStreamI) EXPECT() *MockStreamIMockRecorder {
-	return m.recorder
-}
-
-// CancelRead mocks base method.
-func (m *MockStreamI) CancelRead(arg0 StreamErrorCode) {
-	m.ctrl.T.Helper()
-	m.ctrl.Call(m, "CancelRead", arg0)
-}
-
-// CancelRead indicates an expected call of CancelRead.
-func (mr *MockStreamIMockRecorder) CancelRead(arg0 any) *MockStreamICancelReadCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelRead", reflect.TypeOf((*MockStreamI)(nil).CancelRead), arg0)
-	return &MockStreamICancelReadCall{Call: call}
-}
-
-// MockStreamICancelReadCall wrap *gomock.Call
-type MockStreamICancelReadCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamICancelReadCall) Return() *MockStreamICancelReadCall {
-	c.Call = c.Call.Return()
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamICancelReadCall) Do(f func(StreamErrorCode)) *MockStreamICancelReadCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamICancelReadCall) DoAndReturn(f func(StreamErrorCode)) *MockStreamICancelReadCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// CancelWrite mocks base method.
-func (m *MockStreamI) CancelWrite(arg0 StreamErrorCode) {
-	m.ctrl.T.Helper()
-	m.ctrl.Call(m, "CancelWrite", arg0)
-}
-
-// CancelWrite indicates an expected call of CancelWrite.
-func (mr *MockStreamIMockRecorder) CancelWrite(arg0 any) *MockStreamICancelWriteCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelWrite", reflect.TypeOf((*MockStreamI)(nil).CancelWrite), arg0)
-	return &MockStreamICancelWriteCall{Call: call}
-}
-
-// MockStreamICancelWriteCall wrap *gomock.Call
-type MockStreamICancelWriteCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamICancelWriteCall) Return() *MockStreamICancelWriteCall {
-	c.Call = c.Call.Return()
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamICancelWriteCall) Do(f func(StreamErrorCode)) *MockStreamICancelWriteCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamICancelWriteCall) DoAndReturn(f func(StreamErrorCode)) *MockStreamICancelWriteCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// Close mocks base method.
-func (m *MockStreamI) Close() error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Close")
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// Close indicates an expected call of Close.
-func (mr *MockStreamIMockRecorder) Close() *MockStreamICloseCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockStreamI)(nil).Close))
-	return &MockStreamICloseCall{Call: call}
-}
-
-// MockStreamICloseCall wrap *gomock.Call
-type MockStreamICloseCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamICloseCall) Return(arg0 error) *MockStreamICloseCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamICloseCall) Do(f func() error) *MockStreamICloseCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamICloseCall) DoAndReturn(f func() error) *MockStreamICloseCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// Context mocks base method.
-func (m *MockStreamI) Context() context.Context {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Context")
-	ret0, _ := ret[0].(context.Context)
-	return ret0
-}
-
-// Context indicates an expected call of Context.
-func (mr *MockStreamIMockRecorder) Context() *MockStreamIContextCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockStreamI)(nil).Context))
-	return &MockStreamIContextCall{Call: call}
-}
-
-// MockStreamIContextCall wrap *gomock.Call
-type MockStreamIContextCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIContextCall) Return(arg0 context.Context) *MockStreamIContextCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIContextCall) Do(f func() context.Context) *MockStreamIContextCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIContextCall) DoAndReturn(f func() context.Context) *MockStreamIContextCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// Read mocks base method.
-func (m *MockStreamI) Read(p []byte) (int, error) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Read", p)
-	ret0, _ := ret[0].(int)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// Read indicates an expected call of Read.
-func (mr *MockStreamIMockRecorder) Read(p any) *MockStreamIReadCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStreamI)(nil).Read), p)
-	return &MockStreamIReadCall{Call: call}
-}
-
-// MockStreamIReadCall wrap *gomock.Call
-type MockStreamIReadCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIReadCall) Return(n int, err error) *MockStreamIReadCall {
-	c.Call = c.Call.Return(n, err)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIReadCall) Do(f func([]byte) (int, error)) *MockStreamIReadCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIReadCall) DoAndReturn(f func([]byte) (int, error)) *MockStreamIReadCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// SetDeadline mocks base method.
-func (m *MockStreamI) SetDeadline(t time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetDeadline", t)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// SetDeadline indicates an expected call of SetDeadline.
-func (mr *MockStreamIMockRecorder) SetDeadline(t any) *MockStreamISetDeadlineCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), t)
-	return &MockStreamISetDeadlineCall{Call: call}
-}
-
-// MockStreamISetDeadlineCall wrap *gomock.Call
-type MockStreamISetDeadlineCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamISetDeadlineCall) Return(arg0 error) *MockStreamISetDeadlineCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamISetDeadlineCall) Do(f func(time.Time) error) *MockStreamISetDeadlineCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamISetDeadlineCall) DoAndReturn(f func(time.Time) error) *MockStreamISetDeadlineCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// SetReadDeadline mocks base method.
-func (m *MockStreamI) SetReadDeadline(t time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetReadDeadline", t)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// SetReadDeadline indicates an expected call of SetReadDeadline.
-func (mr *MockStreamIMockRecorder) SetReadDeadline(t any) *MockStreamISetReadDeadlineCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStreamI)(nil).SetReadDeadline), t)
-	return &MockStreamISetReadDeadlineCall{Call: call}
-}
-
-// MockStreamISetReadDeadlineCall wrap *gomock.Call
-type MockStreamISetReadDeadlineCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamISetReadDeadlineCall) Return(arg0 error) *MockStreamISetReadDeadlineCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamISetReadDeadlineCall) Do(f func(time.Time) error) *MockStreamISetReadDeadlineCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamISetReadDeadlineCall) DoAndReturn(f func(time.Time) error) *MockStreamISetReadDeadlineCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// SetWriteDeadline mocks base method.
-func (m *MockStreamI) SetWriteDeadline(t time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "SetWriteDeadline", t)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// SetWriteDeadline indicates an expected call of SetWriteDeadline.
-func (mr *MockStreamIMockRecorder) SetWriteDeadline(t any) *MockStreamISetWriteDeadlineCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), t)
-	return &MockStreamISetWriteDeadlineCall{Call: call}
-}
-
-// MockStreamISetWriteDeadlineCall wrap *gomock.Call
-type MockStreamISetWriteDeadlineCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamISetWriteDeadlineCall) Return(arg0 error) *MockStreamISetWriteDeadlineCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamISetWriteDeadlineCall) Do(f func(time.Time) error) *MockStreamISetWriteDeadlineCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamISetWriteDeadlineCall) DoAndReturn(f func(time.Time) error) *MockStreamISetWriteDeadlineCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// StreamID mocks base method.
-func (m *MockStreamI) StreamID() StreamID {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "StreamID")
-	ret0, _ := ret[0].(StreamID)
-	return ret0
-}
-
-// StreamID indicates an expected call of StreamID.
-func (mr *MockStreamIMockRecorder) StreamID() *MockStreamIStreamIDCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamID", reflect.TypeOf((*MockStreamI)(nil).StreamID))
-	return &MockStreamIStreamIDCall{Call: call}
-}
-
-// MockStreamIStreamIDCall wrap *gomock.Call
-type MockStreamIStreamIDCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIStreamIDCall) Return(arg0 StreamID) *MockStreamIStreamIDCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIStreamIDCall) Do(f func() StreamID) *MockStreamIStreamIDCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIStreamIDCall) DoAndReturn(f func() StreamID) *MockStreamIStreamIDCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// Write mocks base method.
-func (m *MockStreamI) Write(p []byte) (int, error) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Write", p)
-	ret0, _ := ret[0].(int)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// Write indicates an expected call of Write.
-func (mr *MockStreamIMockRecorder) Write(p any) *MockStreamIWriteCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStreamI)(nil).Write), p)
-	return &MockStreamIWriteCall{Call: call}
-}
-
-// MockStreamIWriteCall wrap *gomock.Call
-type MockStreamIWriteCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIWriteCall) Return(n int, err error) *MockStreamIWriteCall {
-	c.Call = c.Call.Return(n, err)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIWriteCall) Do(f func([]byte) (int, error)) *MockStreamIWriteCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIWriteCall) DoAndReturn(f func([]byte) (int, error)) *MockStreamIWriteCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// closeForShutdown mocks base method.
-func (m *MockStreamI) closeForShutdown(arg0 error) {
-	m.ctrl.T.Helper()
-	m.ctrl.Call(m, "closeForShutdown", arg0)
-}
-
-// closeForShutdown indicates an expected call of closeForShutdown.
-func (mr *MockStreamIMockRecorder) closeForShutdown(arg0 any) *MockStreamIcloseForShutdownCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "closeForShutdown", reflect.TypeOf((*MockStreamI)(nil).closeForShutdown), arg0)
-	return &MockStreamIcloseForShutdownCall{Call: call}
-}
-
-// MockStreamIcloseForShutdownCall wrap *gomock.Call
-type MockStreamIcloseForShutdownCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIcloseForShutdownCall) Return() *MockStreamIcloseForShutdownCall {
-	c.Call = c.Call.Return()
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIcloseForShutdownCall) Do(f func(error)) *MockStreamIcloseForShutdownCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIcloseForShutdownCall) DoAndReturn(f func(error)) *MockStreamIcloseForShutdownCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// handleResetStreamFrame mocks base method.
-func (m *MockStreamI) handleResetStreamFrame(arg0 *wire.ResetStreamFrame, arg1 time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "handleResetStreamFrame", arg0, arg1)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// handleResetStreamFrame indicates an expected call of handleResetStreamFrame.
-func (mr *MockStreamIMockRecorder) handleResetStreamFrame(arg0, arg1 any) *MockStreamIhandleResetStreamFrameCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handleResetStreamFrame", reflect.TypeOf((*MockStreamI)(nil).handleResetStreamFrame), arg0, arg1)
-	return &MockStreamIhandleResetStreamFrameCall{Call: call}
-}
-
-// MockStreamIhandleResetStreamFrameCall wrap *gomock.Call
-type MockStreamIhandleResetStreamFrameCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIhandleResetStreamFrameCall) Return(arg0 error) *MockStreamIhandleResetStreamFrameCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIhandleResetStreamFrameCall) Do(f func(*wire.ResetStreamFrame, time.Time) error) *MockStreamIhandleResetStreamFrameCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIhandleResetStreamFrameCall) DoAndReturn(f func(*wire.ResetStreamFrame, time.Time) error) *MockStreamIhandleResetStreamFrameCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// handleStopSendingFrame mocks base method.
-func (m *MockStreamI) handleStopSendingFrame(arg0 *wire.StopSendingFrame) {
-	m.ctrl.T.Helper()
-	m.ctrl.Call(m, "handleStopSendingFrame", arg0)
-}
-
-// handleStopSendingFrame indicates an expected call of handleStopSendingFrame.
-func (mr *MockStreamIMockRecorder) handleStopSendingFrame(arg0 any) *MockStreamIhandleStopSendingFrameCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handleStopSendingFrame", reflect.TypeOf((*MockStreamI)(nil).handleStopSendingFrame), arg0)
-	return &MockStreamIhandleStopSendingFrameCall{Call: call}
-}
-
-// MockStreamIhandleStopSendingFrameCall wrap *gomock.Call
-type MockStreamIhandleStopSendingFrameCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIhandleStopSendingFrameCall) Return() *MockStreamIhandleStopSendingFrameCall {
-	c.Call = c.Call.Return()
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIhandleStopSendingFrameCall) Do(f func(*wire.StopSendingFrame)) *MockStreamIhandleStopSendingFrameCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIhandleStopSendingFrameCall) DoAndReturn(f func(*wire.StopSendingFrame)) *MockStreamIhandleStopSendingFrameCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// handleStreamFrame mocks base method.
-func (m *MockStreamI) handleStreamFrame(arg0 *wire.StreamFrame, arg1 time.Time) error {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "handleStreamFrame", arg0, arg1)
-	ret0, _ := ret[0].(error)
-	return ret0
-}
-
-// handleStreamFrame indicates an expected call of handleStreamFrame.
-func (mr *MockStreamIMockRecorder) handleStreamFrame(arg0, arg1 any) *MockStreamIhandleStreamFrameCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handleStreamFrame", reflect.TypeOf((*MockStreamI)(nil).handleStreamFrame), arg0, arg1)
-	return &MockStreamIhandleStreamFrameCall{Call: call}
-}
-
-// MockStreamIhandleStreamFrameCall wrap *gomock.Call
-type MockStreamIhandleStreamFrameCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIhandleStreamFrameCall) Return(arg0 error) *MockStreamIhandleStreamFrameCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIhandleStreamFrameCall) Do(f func(*wire.StreamFrame, time.Time) error) *MockStreamIhandleStreamFrameCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIhandleStreamFrameCall) DoAndReturn(f func(*wire.StreamFrame, time.Time) error) *MockStreamIhandleStreamFrameCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// hasData mocks base method.
-func (m *MockStreamI) hasData() bool {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "hasData")
-	ret0, _ := ret[0].(bool)
-	return ret0
-}
-
-// hasData indicates an expected call of hasData.
-func (mr *MockStreamIMockRecorder) hasData() *MockStreamIhasDataCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "hasData", reflect.TypeOf((*MockStreamI)(nil).hasData))
-	return &MockStreamIhasDataCall{Call: call}
-}
-
-// MockStreamIhasDataCall wrap *gomock.Call
-type MockStreamIhasDataCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIhasDataCall) Return(arg0 bool) *MockStreamIhasDataCall {
-	c.Call = c.Call.Return(arg0)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIhasDataCall) Do(f func() bool) *MockStreamIhasDataCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIhasDataCall) DoAndReturn(f func() bool) *MockStreamIhasDataCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// popStreamFrame mocks base method.
-func (m *MockStreamI) popStreamFrame(arg0 protocol.ByteCount, arg1 protocol.Version) (ackhandler.StreamFrame, *wire.StreamDataBlockedFrame, bool) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "popStreamFrame", arg0, arg1)
-	ret0, _ := ret[0].(ackhandler.StreamFrame)
-	ret1, _ := ret[1].(*wire.StreamDataBlockedFrame)
-	ret2, _ := ret[2].(bool)
-	return ret0, ret1, ret2
-}
-
-// popStreamFrame indicates an expected call of popStreamFrame.
-func (mr *MockStreamIMockRecorder) popStreamFrame(arg0, arg1 any) *MockStreamIpopStreamFrameCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockStreamI)(nil).popStreamFrame), arg0, arg1)
-	return &MockStreamIpopStreamFrameCall{Call: call}
-}
-
-// MockStreamIpopStreamFrameCall wrap *gomock.Call
-type MockStreamIpopStreamFrameCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIpopStreamFrameCall) Return(arg0 ackhandler.StreamFrame, arg1 *wire.StreamDataBlockedFrame, hasMore bool) *MockStreamIpopStreamFrameCall {
-	c.Call = c.Call.Return(arg0, arg1, hasMore)
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIpopStreamFrameCall) Do(f func(protocol.ByteCount, protocol.Version) (ackhandler.StreamFrame, *wire.StreamDataBlockedFrame, bool)) *MockStreamIpopStreamFrameCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIpopStreamFrameCall) DoAndReturn(f func(protocol.ByteCount, protocol.Version) (ackhandler.StreamFrame, *wire.StreamDataBlockedFrame, bool)) *MockStreamIpopStreamFrameCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
-
-// updateSendWindow mocks base method.
-func (m *MockStreamI) updateSendWindow(arg0 protocol.ByteCount) {
-	m.ctrl.T.Helper()
-	m.ctrl.Call(m, "updateSendWindow", arg0)
-}
-
-// updateSendWindow indicates an expected call of updateSendWindow.
-func (mr *MockStreamIMockRecorder) updateSendWindow(arg0 any) *MockStreamIupdateSendWindowCall {
-	mr.mock.ctrl.T.Helper()
-	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "updateSendWindow", reflect.TypeOf((*MockStreamI)(nil).updateSendWindow), arg0)
-	return &MockStreamIupdateSendWindowCall{Call: call}
-}
-
-// MockStreamIupdateSendWindowCall wrap *gomock.Call
-type MockStreamIupdateSendWindowCall struct {
-	*gomock.Call
-}
-
-// Return rewrite *gomock.Call.Return
-func (c *MockStreamIupdateSendWindowCall) Return() *MockStreamIupdateSendWindowCall {
-	c.Call = c.Call.Return()
-	return c
-}
-
-// Do rewrite *gomock.Call.Do
-func (c *MockStreamIupdateSendWindowCall) Do(f func(protocol.ByteCount)) *MockStreamIupdateSendWindowCall {
-	c.Call = c.Call.Do(f)
-	return c
-}
-
-// DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamIupdateSendWindowCall) DoAndReturn(f func(protocol.ByteCount)) *MockStreamIupdateSendWindowCall {
-	c.Call = c.Call.DoAndReturn(f)
-	return c
-}
diff --git a/mock_stream_manager_test.go b/mock_stream_manager_test.go
index 866e0e93..8d5d9270 100644
--- a/mock_stream_manager_test.go
+++ b/mock_stream_manager_test.go
@@ -43,10 +43,10 @@ func (m *MockStreamManager) EXPECT() *MockStreamManagerMockRecorder {
 }
 
 // AcceptStream mocks base method.
-func (m *MockStreamManager) AcceptStream(arg0 context.Context) (Stream, error) {
+func (m *MockStreamManager) AcceptStream(arg0 context.Context) (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "AcceptStream", arg0)
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -64,19 +64,19 @@ type MockStreamManagerAcceptStreamCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockStreamManagerAcceptStreamCall) Return(arg0 Stream, arg1 error) *MockStreamManagerAcceptStreamCall {
+func (c *MockStreamManagerAcceptStreamCall) Return(arg0 *Stream, arg1 error) *MockStreamManagerAcceptStreamCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockStreamManagerAcceptStreamCall) Do(f func(context.Context) (Stream, error)) *MockStreamManagerAcceptStreamCall {
+func (c *MockStreamManagerAcceptStreamCall) Do(f func(context.Context) (*Stream, error)) *MockStreamManagerAcceptStreamCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamManagerAcceptStreamCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockStreamManagerAcceptStreamCall {
+func (c *MockStreamManagerAcceptStreamCall) DoAndReturn(f func(context.Context) (*Stream, error)) *MockStreamManagerAcceptStreamCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
@@ -309,10 +309,10 @@ func (c *MockStreamManagerHandleMaxStreamsFrameCall) DoAndReturn(f func(*wire.Ma
 }
 
 // OpenStream mocks base method.
-func (m *MockStreamManager) OpenStream() (Stream, error) {
+func (m *MockStreamManager) OpenStream() (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "OpenStream")
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -330,28 +330,28 @@ type MockStreamManagerOpenStreamCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockStreamManagerOpenStreamCall) Return(arg0 Stream, arg1 error) *MockStreamManagerOpenStreamCall {
+func (c *MockStreamManagerOpenStreamCall) Return(arg0 *Stream, arg1 error) *MockStreamManagerOpenStreamCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockStreamManagerOpenStreamCall) Do(f func() (Stream, error)) *MockStreamManagerOpenStreamCall {
+func (c *MockStreamManagerOpenStreamCall) Do(f func() (*Stream, error)) *MockStreamManagerOpenStreamCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamManagerOpenStreamCall) DoAndReturn(f func() (Stream, error)) *MockStreamManagerOpenStreamCall {
+func (c *MockStreamManagerOpenStreamCall) DoAndReturn(f func() (*Stream, error)) *MockStreamManagerOpenStreamCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
 
 // OpenStreamSync mocks base method.
-func (m *MockStreamManager) OpenStreamSync(arg0 context.Context) (Stream, error) {
+func (m *MockStreamManager) OpenStreamSync(arg0 context.Context) (*Stream, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "OpenStreamSync", arg0)
-	ret0, _ := ret[0].(Stream)
+	ret0, _ := ret[0].(*Stream)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -369,19 +369,19 @@ type MockStreamManagerOpenStreamSyncCall struct {
 }
 
 // Return rewrite *gomock.Call.Return
-func (c *MockStreamManagerOpenStreamSyncCall) Return(arg0 Stream, arg1 error) *MockStreamManagerOpenStreamSyncCall {
+func (c *MockStreamManagerOpenStreamSyncCall) Return(arg0 *Stream, arg1 error) *MockStreamManagerOpenStreamSyncCall {
 	c.Call = c.Call.Return(arg0, arg1)
 	return c
 }
 
 // Do rewrite *gomock.Call.Do
-func (c *MockStreamManagerOpenStreamSyncCall) Do(f func(context.Context) (Stream, error)) *MockStreamManagerOpenStreamSyncCall {
+func (c *MockStreamManagerOpenStreamSyncCall) Do(f func(context.Context) (*Stream, error)) *MockStreamManagerOpenStreamSyncCall {
 	c.Call = c.Call.Do(f)
 	return c
 }
 
 // DoAndReturn rewrite *gomock.Call.DoAndReturn
-func (c *MockStreamManagerOpenStreamSyncCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockStreamManagerOpenStreamSyncCall {
+func (c *MockStreamManagerOpenStreamSyncCall) DoAndReturn(f func(context.Context) (*Stream, error)) *MockStreamManagerOpenStreamSyncCall {
 	c.Call = c.Call.DoAndReturn(f)
 	return c
 }
diff --git a/stream_test.go b/stream_test.go
index fe694c75..4b480730 100644
--- a/stream_test.go
+++ b/stream_test.go
@@ -38,7 +38,7 @@ func TestStreamDeadlines(t *testing.T) {
 func TestStreamCompletion(t *testing.T) {
 	completeReadSide := func(
 		t *testing.T,
-		str *stream,
+		str *Stream,
 		mockCtrl *gomock.Controller,
 		mockFC *mocks.MockStreamFlowController,
 	) {
@@ -57,7 +57,7 @@ func TestStreamCompletion(t *testing.T) {
 
 	completeWriteSide := func(
 		t *testing.T,
-		str *stream,
+		str *Stream,
 		mockCtrl *gomock.Controller,
 		mockFC *mocks.MockStreamFlowController,
 		mockSender *MockStreamSender,