diff --git a/internal/mocks/quic.go b/internal/mocks/quic.go index d42d9aeed8..f6c0c7c392 100644 --- a/internal/mocks/quic.go +++ b/internal/mocks/quic.go @@ -49,8 +49,8 @@ type QUICEarlyConnection struct { MockConnectionState func() quic.ConnectionState MockHandshakeComplete func() <-chan struct{} MockNextConnection func() quic.Connection - MockSendMessage func(b []byte) error - MockReceiveMessage func(ctx context.Context) ([]byte, error) + MockSendDatagram func(b []byte) error + MockReceiveDatagram func(ctx context.Context) ([]byte, error) } var _ quic.EarlyConnection = &QUICEarlyConnection{} @@ -121,14 +121,14 @@ func (s *QUICEarlyConnection) NextConnection() quic.Connection { return s.MockNextConnection() } -// SendMessage calls MockSendMessage. -func (s *QUICEarlyConnection) SendMessage(b []byte) error { - return s.MockSendMessage(b) +// SendDatagram calls MockSendDatagram. +func (s *QUICEarlyConnection) SendDatagram(b []byte) error { + return s.MockSendDatagram(b) } -// ReceiveMessage calls MockReceiveMessage. -func (s *QUICEarlyConnection) ReceiveMessage(ctx context.Context) ([]byte, error) { - return s.MockReceiveMessage(ctx) +// ReceiveDatagram calls MockReceiveDatagram. +func (s *QUICEarlyConnection) ReceiveDatagram(ctx context.Context) ([]byte, error) { + return s.MockReceiveDatagram(ctx) } // UDPLikeConn is an UDP conn used by QUIC. diff --git a/internal/mocks/quic_test.go b/internal/mocks/quic_test.go index 93fc00f937..aafc0d4870 100644 --- a/internal/mocks/quic_test.go +++ b/internal/mocks/quic_test.go @@ -239,29 +239,29 @@ func TestQUICEarlyConnection(t *testing.T) { } }) - t.Run("SendMessage", func(t *testing.T) { + t.Run("SendDatagram", func(t *testing.T) { expected := errors.New("mocked error") qconn := &QUICEarlyConnection{ - MockSendMessage: func(b []byte) error { + MockSendDatagram: func(b []byte) error { return expected }, } b := make([]byte, 17) - err := qconn.SendMessage(b) + err := qconn.SendDatagram(b) if !errors.Is(err, expected) { t.Fatal("not the error we expected", err) } }) - t.Run("ReceiveMessage", func(t *testing.T) { + t.Run("ReceiveDatagram", func(t *testing.T) { expected := errors.New("mocked error") ctx := context.Background() qconn := &QUICEarlyConnection{ - MockReceiveMessage: func(ctx context.Context) ([]byte, error) { + MockReceiveDatagram: func(ctx context.Context) ([]byte, error) { return nil, expected }, } - b, err := qconn.ReceiveMessage(ctx) + b, err := qconn.ReceiveDatagram(ctx) if !errors.Is(err, expected) { t.Fatal("not the error we expected", err) }