Переглянути джерело

Test case for auth response tobytes

V2Ray 10 роки тому
батько
коміт
07b440fdcb
1 змінених файлів з 18 додано та 0 видалено
  1. 18 0
      io/socks/socks_test.go

+ 18 - 0
io/socks/socks_test.go

@@ -0,0 +1,18 @@
+package socks
+
+import (
+	"testing"
+)
+
+func TestAuthenticationResponseToBytes(t *testing.T) {
+  socksVersion := uint8(5)
+  authMethod := uint8(1)
+	response := Socks5AuthenticationResponse{socksVersion, authMethod}
+	bytes := response.ToBytes()
+	if bytes[0] != socksVersion {
+		t.Errorf("Unexpected Socks version %d", bytes[0])
+	}
+  if bytes[1] != authMethod {
+    t.Errorf("Unexpected Socks auth method %d", bytes[1])
+  }
+}