3
3
package pool
4
4
5
5
import (
6
- "crypto/tls"
7
6
"net"
8
7
"net/http/httptest"
9
8
"time"
@@ -15,17 +14,12 @@ import (
15
14
var _ = Describe ("tests conn_check with real conns" , func () {
16
15
var ts * httptest.Server
17
16
var conn net.Conn
18
- var tlsConn * tls.Conn
19
17
var err error
20
18
21
19
BeforeEach (func () {
22
20
ts = httptest .NewServer (nil )
23
21
conn , err = net .DialTimeout (ts .Listener .Addr ().Network (), ts .Listener .Addr ().String (), time .Second )
24
22
Expect (err ).NotTo (HaveOccurred ())
25
- tlsTestServer := httptest .NewUnstartedServer (nil )
26
- tlsTestServer .StartTLS ()
27
- tlsConn , err = tls .DialWithDialer (& net.Dialer {Timeout : time .Second }, tlsTestServer .Listener .Addr ().Network (), tlsTestServer .Listener .Addr ().String (), & tls.Config {InsecureSkipVerify : true })
28
- Expect (err ).NotTo (HaveOccurred ())
29
23
})
30
24
31
25
AfterEach (func () {
@@ -39,23 +33,11 @@ var _ = Describe("tests conn_check with real conns", func() {
39
33
Expect (connCheck (conn )).To (HaveOccurred ())
40
34
})
41
35
42
- It ("good tls conn check" , func () {
43
- Expect (connCheck (tlsConn )).NotTo (HaveOccurred ())
44
-
45
- Expect (tlsConn .Close ()).NotTo (HaveOccurred ())
46
- Expect (connCheck (tlsConn )).To (HaveOccurred ())
47
- })
48
-
49
36
It ("bad conn check" , func () {
50
37
Expect (conn .Close ()).NotTo (HaveOccurred ())
51
38
Expect (connCheck (conn )).To (HaveOccurred ())
52
39
})
53
40
54
- It ("bad tls conn check" , func () {
55
- Expect (tlsConn .Close ()).NotTo (HaveOccurred ())
56
- Expect (connCheck (tlsConn )).To (HaveOccurred ())
57
- })
58
-
59
41
It ("check conn deadline" , func () {
60
42
Expect (conn .SetDeadline (time .Now ())).NotTo (HaveOccurred ())
61
43
time .Sleep (time .Millisecond * 10 )
0 commit comments