forked from database64128/tfo-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tfo_unsupported_test.go
52 lines (44 loc) · 1.05 KB
/
tfo_unsupported_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//go:build !darwin && !freebsd && !linux && !windows
package tfo
import (
"context"
"testing"
)
func TestListenTFO(t *testing.T) {
ln, err := Listen("tcp", "")
if ln != nil {
t.Error("Expected nil listener")
}
if err != ErrPlatformUnsupported {
t.Errorf("Expected ErrPlatformUnsupported, got %v", err)
}
lntcp, err := ListenTCP("tcp", nil)
if lntcp != nil {
t.Error("Expected nil listener")
}
if err != ErrPlatformUnsupported {
t.Errorf("Expected ErrPlatformUnsupported, got %v", err)
}
}
func TestDialTFO(t *testing.T) {
s, err := newDiscardTCPServer(context.Background())
if err != nil {
t.Fatal(err)
}
defer s.Close()
addr := s.Addr()
c, err := Dial("tcp", addr.String(), hello)
if c != nil {
t.Error("Expected nil connection")
}
if err != ErrPlatformUnsupported {
t.Errorf("Expected ErrPlatformUnsupported, got %v", err)
}
tc, err := DialTCP("tcp", nil, addr, hello)
if tc != nil {
t.Error("Expected nil connection")
}
if err != ErrPlatformUnsupported {
t.Errorf("Expected ErrPlatformUnsupported, got %v", err)
}
}