@@ -125,14 +125,14 @@ var serverKey = loadPEM('agent2-key');
125
125
var serverCert = loadPEM ( 'agent2-cert' ) ;
126
126
127
127
128
- function runClient ( options , cb ) {
128
+ function runClient ( port , options , cb ) {
129
129
130
130
// Client can connect in three ways:
131
131
// - Self-signed cert
132
132
// - Certificate, but not signed by CA.
133
133
// - Certificate signed by CA.
134
134
135
- var args = [ 's_client' , '-connect' , '127.0.0.1:' + common . PORT ] ;
135
+ var args = [ 's_client' , '-connect' , '127.0.0.1:' + port ] ;
136
136
137
137
138
138
console . log ( ' connecting with' , options . name ) ;
@@ -230,7 +230,7 @@ function runClient(options, cb) {
230
230
231
231
// Run the tests
232
232
var successfulTests = 0 ;
233
- function runTest ( testIndex ) {
233
+ function runTest ( port , testIndex ) {
234
234
var tcase = testCases [ testIndex ] ;
235
235
if ( ! tcase ) return ;
236
236
@@ -293,31 +293,31 @@ function runTest(testIndex) {
293
293
function runNextClient ( clientIndex ) {
294
294
var options = tcase . clients [ clientIndex ] ;
295
295
if ( options ) {
296
- runClient ( options , function ( ) {
296
+ runClient ( port , options , function ( ) {
297
297
runNextClient ( clientIndex + 1 ) ;
298
298
} ) ;
299
299
} else {
300
300
server . close ( ) ;
301
301
successfulTests ++ ;
302
- runTest ( testIndex + 1 ) ;
302
+ runTest ( port , nextTest ++ ) ;
303
303
}
304
304
}
305
305
306
- server . listen ( common . PORT , function ( ) {
306
+ server . listen ( port , function ( ) {
307
307
if ( tcase . debug ) {
308
- console . error ( 'TLS server running on port ' + common . PORT ) ;
308
+ console . error ( 'TLS server running on port ' + port ) ;
309
309
} else {
310
310
if ( tcase . renegotiate ) {
311
311
runNextClient ( 0 ) ;
312
312
} else {
313
313
var clientsCompleted = 0 ;
314
314
for ( var i = 0 ; i < tcase . clients . length ; i ++ ) {
315
- runClient ( tcase . clients [ i ] , function ( ) {
315
+ runClient ( port , tcase . clients [ i ] , function ( ) {
316
316
clientsCompleted ++ ;
317
317
if ( clientsCompleted === tcase . clients . length ) {
318
318
server . close ( ) ;
319
319
successfulTests ++ ;
320
- runTest ( testIndex + 1 ) ;
320
+ runTest ( port , nextTest ++ ) ;
321
321
}
322
322
} ) ;
323
323
}
@@ -327,7 +327,9 @@ function runTest(testIndex) {
327
327
}
328
328
329
329
330
- runTest ( 0 ) ;
330
+ var nextTest = 0 ;
331
+ runTest ( common . PORT , nextTest ++ ) ;
332
+ runTest ( common . PORT + 1 , nextTest ++ ) ;
331
333
332
334
333
335
process . on ( 'exit' , function ( ) {
0 commit comments