2016-06-02 19:34:25 +00:00
|
|
|
package protocol_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-08-20 18:55:45 +00:00
|
|
|
. "v2ray.com/core/common/protocol"
|
|
|
|
"v2ray.com/core/testing/assert"
|
2016-06-02 19:34:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRequestOptionSet(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
2016-06-02 19:48:49 +00:00
|
|
|
var option RequestOption
|
2016-06-02 19:34:25 +00:00
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
|
|
|
|
|
|
|
|
option.Set(RequestOptionChunkStream)
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
|
|
|
|
|
2017-04-07 19:54:40 +00:00
|
|
|
option.Set(RequestOptionChunkMasking)
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue()
|
2016-06-02 19:34:25 +00:00
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRequestOptionClear(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
2016-06-02 19:48:49 +00:00
|
|
|
var option RequestOption
|
2016-06-02 19:34:25 +00:00
|
|
|
option.Set(RequestOptionChunkStream)
|
2017-04-07 19:54:40 +00:00
|
|
|
option.Set(RequestOptionChunkMasking)
|
2016-06-02 19:34:25 +00:00
|
|
|
|
|
|
|
option.Clear(RequestOptionChunkStream)
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
|
2017-04-07 19:54:40 +00:00
|
|
|
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue()
|
2016-06-02 19:34:25 +00:00
|
|
|
}
|