@@ -4,7 +4,6 @@ const common = require('../common');
4
4
if ( ! common . hasCrypto )
5
5
common . skip ( 'missing crypto' ) ;
6
6
7
- const assert = require ( 'assert' ) ;
8
7
const https = require ( 'https' ) ;
9
8
const tls = require ( 'tls' ) ;
10
9
const fs = require ( 'fs' ) ;
@@ -29,14 +28,11 @@ function run() {
29
28
}
30
29
31
30
test ( function serverKeepAliveTimeoutWithPipeline ( cb ) {
32
- let requestCount = 0 ;
33
- process . on ( 'exit' , function ( ) {
34
- assert . strictEqual ( requestCount , 3 ) ;
35
- } ) ;
36
- const server = https . createServer ( serverOptions , ( req , res ) => {
37
- requestCount ++ ;
38
- res . end ( ) ;
39
- } ) ;
31
+ const server = https . createServer (
32
+ serverOptions ,
33
+ common . mustCall ( ( req , res ) => {
34
+ res . end ( ) ;
35
+ } , 3 ) ) ;
40
36
server . setTimeout ( 500 , common . mustCall ( ( socket ) => {
41
37
// End this test and call `run()` for the next test (if any).
42
38
socket . destroy ( ) ;
@@ -59,13 +55,7 @@ test(function serverKeepAliveTimeoutWithPipeline(cb) {
59
55
} ) ;
60
56
61
57
test ( function serverNoEndKeepAliveTimeoutWithPipeline ( cb ) {
62
- let requestCount = 0 ;
63
- process . on ( 'exit' , ( ) => {
64
- assert . strictEqual ( requestCount , 3 ) ;
65
- } ) ;
66
- const server = https . createServer ( serverOptions , ( req , res ) => {
67
- requestCount ++ ;
68
- } ) ;
58
+ const server = https . createServer ( serverOptions , common . mustCall ( 3 ) ) ;
69
59
server . setTimeout ( 500 , common . mustCall ( ( socket ) => {
70
60
// End this test and call `run()` for the next test (if any).
71
61
socket . destroy ( ) ;
0 commit comments