github.com/sagernet/netlink@v0.0.0-20240612041022-b9a21c07ac6a/handle_linux_test.go (about) 1 package netlink 2 3 import ( 4 "testing" 5 "time" 6 ) 7 8 func TestSetGetSocketTimeout(t *testing.T) { 9 timeout := 10 * time.Second 10 if err := SetSocketTimeout(10 * time.Second); err != nil { 11 t.Fatalf("Set socket timeout for default handle failed: %v", err) 12 } 13 14 if val := GetSocketTimeout(); val != timeout { 15 t.Fatalf("Unexpected socket timeout value: got=%v, expected=%v", val, timeout) 16 } 17 }