2016-08-08 16:47:59 -04:00
|
|
|
package internet_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-10-17 08:35:13 -04:00
|
|
|
"v2ray.com/core/common/loader"
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/testing/assert"
|
|
|
|
. "v2ray.com/core/transport/internet"
|
2016-10-17 08:35:13 -04:00
|
|
|
"v2ray.com/core/transport/internet/authenticators/noop"
|
|
|
|
"v2ray.com/core/transport/internet/authenticators/srtp"
|
|
|
|
"v2ray.com/core/transport/internet/authenticators/utp"
|
2016-08-08 16:47:59 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestAllAuthenticatorLoadable(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
2016-10-17 08:35:13 -04:00
|
|
|
noopAuth, err := CreateAuthenticator(loader.GetType(new(noop.Config)), nil)
|
2016-08-08 16:47:59 -04:00
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Int(noopAuth.Overhead()).Equals(0)
|
|
|
|
|
2016-10-17 08:35:13 -04:00
|
|
|
srtp, err := CreateAuthenticator(loader.GetType(new(srtp.Config)), nil)
|
2016-08-08 16:47:59 -04:00
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Int(srtp.Overhead()).Equals(4)
|
|
|
|
|
2016-10-17 08:35:13 -04:00
|
|
|
utp, err := CreateAuthenticator(loader.GetType(new(utp.Config)), nil)
|
2016-08-08 16:47:59 -04:00
|
|
|
assert.Error(err).IsNil()
|
|
|
|
assert.Int(utp.Overhead()).Equals(4)
|
|
|
|
}
|