1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-12 06:54:23 -04:00
v2fly/transport/internet/headers/srtp/srtp_test.go

27 lines
521 B
Go
Raw Normal View History

2016-08-07 03:08:30 -04:00
package srtp_test
import (
2017-12-16 17:31:05 -05:00
"context"
2016-08-07 03:08:30 -04:00
"testing"
2016-12-09 05:35:27 -05:00
"v2ray.com/core/common/buf"
2016-12-08 10:27:41 -05:00
. "v2ray.com/core/transport/internet/headers/srtp"
2017-10-26 15:44:22 -04:00
. "v2ray.com/ext/assert"
2016-08-07 03:08:30 -04:00
)
2016-12-08 10:27:41 -05:00
func TestSRTPWrite(t *testing.T) {
2017-10-24 10:15:35 -04:00
assert := With(t)
2016-08-07 03:08:30 -04:00
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
2017-12-16 17:31:05 -05:00
srtpRaw, err := New(context.Background(), &Config{})
assert(err, IsNil)
srtp := srtpRaw.(*SRTP)
2016-12-08 10:27:41 -05:00
2018-03-11 18:45:24 -04:00
payload := buf.New()
2016-12-09 06:08:25 -05:00
payload.AppendSupplier(srtp.Write)
2016-12-06 05:03:42 -05:00
payload.Append(content)
2018-04-02 14:00:50 -04:00
assert(payload.Len(), Equals, int32(len(content))+srtp.Size())
2016-08-07 03:08:30 -04:00
}