Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (36 sloc) 0.97 kb
require('helper')
local fixture = require('./fixture-tls')
local tls = require('tls')
local options = {
cert = fixture.certPem,
key = fixture.keyPem
}
local serverConnected = 0
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()
client2 = tls.connect({port = fixture.commonPort, host = '127.0.0.1'}, {}, function()
clientConnected = clientConnected + 1
client2:destroy()
end)
end)
end)
process:on('error', function(err)
print('unhandled error!')
p(err)
assert(false)
end)
process:on('exit', function()
assert(serverConnected == 2)
assert(clientConnected == 2)
end)
Jump to Line
Something went wrong with that request. Please try again.