mirror of https://github.com/v2ray/v2ray-core
parent
80312627c4
commit
bae0de7d95
@ -0,0 +1,23 @@
|
||||
package http_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/alloc"
|
||||
"v2ray.com/core/testing/assert"
|
||||
. "v2ray.com/core/transport/internet/authenticators/http"
|
||||
)
|
||||
|
||||
func TestReaderWriter(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
cache := alloc.NewBuffer()
|
||||
writer := NewHeaderWriter(alloc.NewLocalBuffer(256).Clear().AppendString("abcd" + ENDING))
|
||||
writer.Write(cache)
|
||||
cache.Write([]byte{'e', 'f', 'g'})
|
||||
|
||||
reader := &HeaderReader{}
|
||||
buffer, err := reader.Read(cache)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Bytes(buffer.Value).Equals([]byte{'e', 'f', 'g'})
|
||||
}
|
Loading…
Reference in new issue