|
|
|
@ -5,7 +5,6 @@ import (
|
|
|
|
|
"io"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"v2ray.com/core/app/stats"
|
|
|
|
|
"v2ray.com/core/common/buf"
|
|
|
|
|
. "v2ray.com/core/transport/ray"
|
|
|
|
|
. "v2ray.com/ext/assert"
|
|
|
|
@ -48,18 +47,3 @@ func TestStreamClose(t *testing.T) {
|
|
|
|
|
_, err = stream.ReadMultiBuffer()
|
|
|
|
|
assert(err, Equals, io.EOF)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestStreamStatCounter(t *testing.T) {
|
|
|
|
|
assert := With(t)
|
|
|
|
|
|
|
|
|
|
c := new(stats.Counter)
|
|
|
|
|
stream := NewStream(context.Background(), WithStatCounter(c))
|
|
|
|
|
|
|
|
|
|
b1 := buf.New()
|
|
|
|
|
b1.AppendBytes('a', 'b', 'c', 'd')
|
|
|
|
|
assert(stream.WriteMultiBuffer(buf.NewMultiBufferValue(b1)), IsNil)
|
|
|
|
|
|
|
|
|
|
stream.Close()
|
|
|
|
|
|
|
|
|
|
assert(c.Value(), Equals, int64(4))
|
|
|
|
|
}
|
|
|
|
|