1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-05 19:44:32 -04:00
v2fly/transport/internet/headers/tls/dtls_test.go
2018-05-25 17:16:15 +02:00

27 lines
524 B
Go

package tls_test
import (
"context"
"testing"
"v2ray.com/core/common/buf"
. "v2ray.com/core/transport/internet/headers/tls"
. "v2ray.com/ext/assert"
)
func TestDTLSWrite(t *testing.T) {
assert := With(t)
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
dtlsRaw, err := New(context.Background(), &PacketConfig{})
assert(err, IsNil)
dtls := dtlsRaw.(*DTLS)
payload := buf.New()
payload.AppendSupplier(dtls.Write)
payload.Write(content)
assert(payload.Len(), Equals, int32(len(content))+dtls.Size())
}