1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 03:37:37 -05:00
v2fly/transport/internet/authenticators/srtp/srtp_test.go

22 lines
565 B
Go
Raw Normal View History

2016-08-07 03:08:30 -04:00
package srtp_test
import (
"testing"
"github.com/v2ray/v2ray-core/common/alloc"
"github.com/v2ray/v2ray-core/testing/assert"
. "github.com/v2ray/v2ray-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)
2016-08-07 09:05:05 -04:00
srtp := SRTP{}
2016-08-07 03:08:30 -04:00
srtp.Seal(payload)
assert.Int(payload.Len()).GreaterThan(len(content))
assert.Bool(srtp.Open(payload)).IsTrue()
assert.Bytes(content).Equals(payload.Bytes())
}