socks_test.go 422 B

123456789101112131415161718
  1. package socks
  2. import (
  3. "testing"
  4. )
  5. func TestAuthenticationResponseToBytes(t *testing.T) {
  6. socksVersion := uint8(5)
  7. authMethod := uint8(1)
  8. response := Socks5AuthenticationResponse{socksVersion, authMethod}
  9. bytes := response.ToBytes()
  10. if bytes[0] != socksVersion {
  11. t.Errorf("Unexpected Socks version %d", bytes[0])
  12. }
  13. if bytes[1] != authMethod {
  14. t.Errorf("Unexpected Socks auth method %d", bytes[1])
  15. }
  16. }