github.com/pion/dtls/v2@v2.2.12/pkg/protocol/extension/renegotiation_info_test.go (about) 1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> 2 // SPDX-License-Identifier: MIT 3 4 package extension 5 6 import "testing" 7 8 func TestRenegotiationInfo(t *testing.T) { 9 extension := RenegotiationInfo{RenegotiatedConnection: 0} 10 11 raw, err := extension.Marshal() 12 if err != nil { 13 t.Fatal(err) 14 } 15 16 newExtension := RenegotiationInfo{} 17 err = newExtension.Unmarshal(raw) 18 if err != nil { 19 t.Fatal(err) 20 } 21 22 if newExtension.RenegotiatedConnection != extension.RenegotiatedConnection { 23 t.Errorf("extensionRenegotiationInfo marshal: got %d expected %d", newExtension.RenegotiatedConnection, extension.RenegotiatedConnection) 24 } 25 }