2016-08-07 03:08:30 -04:00
|
|
|
package srtp_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-12-09 05:35:27 -05:00
|
|
|
"v2ray.com/core/common/buf"
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/testing/assert"
|
2016-12-08 10:27:41 -05:00
|
|
|
. "v2ray.com/core/transport/internet/headers/srtp"
|
2016-08-07 03:08:30 -04:00
|
|
|
)
|
|
|
|
|
2016-12-08 10:27:41 -05:00
|
|
|
func TestSRTPWrite(t *testing.T) {
|
2016-08-07 03:08:30 -04:00
|
|
|
assert := assert.On(t)
|
|
|
|
|
|
|
|
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
|
2016-12-08 10:27:41 -05:00
|
|
|
srtp := SRTP{}
|
|
|
|
|
2016-12-09 06:08:25 -05:00
|
|
|
payload := buf.NewLocal(2048)
|
|
|
|
payload.AppendSupplier(srtp.Write)
|
2016-12-06 05:03:42 -05:00
|
|
|
payload.Append(content)
|
|
|
|
|
2016-12-08 10:27:41 -05:00
|
|
|
assert.Int(payload.Len()).Equals(len(content) + srtp.Size())
|
2016-08-07 03:08:30 -04:00
|
|
|
}
|