1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-14 00:07:09 -05:00
v2fly/transport/internet/headers/tls/dtls_test.go
2022-01-02 15:16:23 +00:00

27 lines
637 B
Go

package tls_test
import (
"context"
"testing"
"github.com/v2fly/v2ray-core/v5/common"
"github.com/v2fly/v2ray-core/v5/common/buf"
. "github.com/v2fly/v2ray-core/v5/transport/internet/headers/tls"
)
func TestDTLSWrite(t *testing.T) {
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
dtlsRaw, err := New(context.Background(), &PacketConfig{})
common.Must(err)
dtls := dtlsRaw.(*DTLS)
payload := buf.New()
dtls.Serialize(payload.Extend(dtls.Size()))
payload.Write(content)
if payload.Len() != int32(len(content))+dtls.Size() {
t.Error("payload len: ", payload.Len(), " want ", int32(len(content))+dtls.Size())
}
}