1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-24 02:57:25 -05:00
v2fly/transport/internet/authenticators/srtp/srtp_test.go
2016-08-20 20:55:45 +02:00

22 lines
526 B
Go

package srtp_test
import (
"testing"
"v2ray.com/core/common/alloc"
"v2ray.com/core/testing/assert"
. "v2ray.com/core/transport/internet/authenticators/srtp"
)
func TestSRTPOpenSeal(t *testing.T) {
assert := assert.On(t)
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
payload := alloc.NewLocalBuffer(2048).Clear().Append(content)
srtp := SRTP{}
srtp.Seal(payload)
assert.Int(payload.Len()).GreaterThan(len(content))
assert.Bool(srtp.Open(payload)).IsTrue()
assert.Bytes(content).Equals(payload.Bytes())
}