Permalink
Browse files

tests: test-tls-connect-simple: do two connections

test having two connections like node's test does
  • Loading branch information...
1 parent db03bbe commit 428ffa8a9dcd38ab83c96b822cf8664249d17ca0 Brandon Philips committed Apr 19, 2012
Showing with 13 additions and 2 deletions.
  1. +13 −2 tests/test-tls-connect-simple.lua
@@ -13,14 +13,25 @@ local clientConnected = 0
local server
server = tls.createServer(options, function(conn)
serverConnected = serverConnected + 1
+ if (serverConnected == 2) then
+ server:close()
+ end
end)
server:listen(fixture.commonPort, function()
local client1, client2
client1 = tls.connect({port = fixture.commonPort, host = '127.0.0.1'}, {}, function()
clientConnected = clientConnected + 1
client1:destroy()
- server:close()
- assert(serverConnected == 1)
end)
+
+ client2 = tls.connect({port = fixture.commonPort, host = '127.0.0.1'}, {}, function()
+ clientConnected = clientConnected + 1
+ client2:destroy()
+ end)
+end)
+
+process:on('exit', function()
+ assert(serverConnected == 2)
+ assert(clientConnected == 2)
end)

0 comments on commit 428ffa8

Please sign in to comment.