Skip to content

Commit

Permalink
multiple tls conns
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Aug 9, 2018
1 parent e7d45d8 commit 55a4c8a
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions testing/scenarios/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,22 @@ func TestAutoIssuingCertificate(t *testing.T) {
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
assert(err, IsNil)

conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{
IP: []byte{127, 0, 0, 1},
Port: int(clientPort),
})
assert(err, IsNil)

payload := "dokodemo request."
nBytes, err := conn.Write([]byte(payload))
assert(err, IsNil)
assert(nBytes, Equals, len(payload))

response := readFrom(conn, time.Second*2, len(payload))
assert(response, Equals, xor([]byte(payload)))
assert(conn.Close(), IsNil)
for i := 0; i < 10; i++ {
conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{
IP: []byte{127, 0, 0, 1},
Port: int(clientPort),
})
assert(err, IsNil)

payload := "dokodemo request."
nBytes, err := conn.Write([]byte(payload))
assert(err, IsNil)
assert(nBytes, Equals, len(payload))

response := readFrom(conn, time.Second*2, len(payload))
assert(response, Equals, xor([]byte(payload)))
assert(conn.Close(), IsNil)
}

CloseAllServers(servers)
}
Expand Down

0 comments on commit 55a4c8a

Please sign in to comment.