2017-01-03 16:46:22 -05:00
|
|
|
package wechat_test
|
|
|
|
|
|
|
|
import (
|
2017-12-16 17:31:05 -05:00
|
|
|
"context"
|
2017-01-03 16:46:22 -05:00
|
|
|
"testing"
|
|
|
|
|
2019-01-31 14:57:01 -05:00
|
|
|
"v2ray.com/core/common"
|
2017-01-03 16:46:22 -05:00
|
|
|
"v2ray.com/core/common/buf"
|
|
|
|
. "v2ray.com/core/transport/internet/headers/wechat"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestUTPWrite(t *testing.T) {
|
2017-12-16 17:31:05 -05:00
|
|
|
videoRaw, err := NewVideoChat(context.Background(), &VideoConfig{})
|
2019-01-31 14:57:01 -05:00
|
|
|
common.Must(err)
|
2017-12-16 17:31:05 -05:00
|
|
|
|
|
|
|
video := videoRaw.(*VideoChat)
|
2017-01-03 16:46:22 -05:00
|
|
|
|
2018-03-11 18:45:24 -04:00
|
|
|
payload := buf.New()
|
2018-11-02 16:34:04 -04:00
|
|
|
video.Serialize(payload.Extend(video.Size()))
|
2017-01-03 16:46:22 -05:00
|
|
|
|
2019-01-31 14:57:01 -05:00
|
|
|
if payload.Len() != video.Size() {
|
|
|
|
t.Error("expected payload size ", video.Size(), " but got ", payload.Len())
|
|
|
|
}
|
2017-01-03 16:46:22 -05:00
|
|
|
}
|