mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-19 10:56:06 -05:00
test case for srtp
This commit is contained in:
parent
2f0d602833
commit
4a7400ef2a
21
transport/internet/authenticators/srtp/srtp_test.go
Normal file
21
transport/internet/authenticators/srtp/srtp_test.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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)
|
||||||
|
srtp := ObfuscatorSRTP{}
|
||||||
|
srtp.Seal(payload)
|
||||||
|
assert.Int(payload.Len()).GreaterThan(len(content))
|
||||||
|
assert.Bool(srtp.Open(payload)).IsTrue()
|
||||||
|
assert.Bytes(content).Equals(payload.Bytes())
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user