@@ -37,15 +37,17 @@ assert(Buffer.isBuffer(cert));
37
37
assert . strictEqual ( typeof passKey . toString ( ) , 'string' ) ;
38
38
assert . strictEqual ( typeof cert . toString ( ) , 'string' ) ;
39
39
40
+ function onSecureConnect ( ) {
41
+ return common . mustCall ( function ( ) { this . end ( ) ; } ) ;
42
+ }
43
+
40
44
const server = tls . Server ( {
41
45
key : passKey ,
42
46
passphrase : 'password' ,
43
47
cert : cert ,
44
48
ca : [ cert ] ,
45
49
requestCert : true ,
46
50
rejectUnauthorized : true
47
- } , function ( s ) {
48
- s . end ( ) ;
49
51
} ) ;
50
52
51
53
server . listen ( 0 , common . mustCall ( function ( ) {
@@ -56,22 +58,22 @@ server.listen(0, common.mustCall(function() {
56
58
passphrase : 'password' ,
57
59
cert : cert ,
58
60
rejectUnauthorized : false
59
- } , common . mustCall ( ) ) ;
61
+ } , onSecureConnect ( ) ) ;
60
62
61
63
tls . connect ( {
62
64
port : this . address ( ) . port ,
63
65
key : rawKey ,
64
66
cert : cert ,
65
67
rejectUnauthorized : false
66
- } , common . mustCall ( ) ) ;
68
+ } , onSecureConnect ( ) ) ;
67
69
68
70
tls . connect ( {
69
71
port : this . address ( ) . port ,
70
72
key : rawKey ,
71
73
passphrase : 'ignored' ,
72
74
cert : cert ,
73
75
rejectUnauthorized : false
74
- } , common . mustCall ( ) ) ;
76
+ } , onSecureConnect ( ) ) ;
75
77
76
78
// Buffer[]
77
79
tls . connect ( {
@@ -80,22 +82,22 @@ server.listen(0, common.mustCall(function() {
80
82
passphrase : 'password' ,
81
83
cert : [ cert ] ,
82
84
rejectUnauthorized : false
83
- } , common . mustCall ( ) ) ;
85
+ } , onSecureConnect ( ) ) ;
84
86
85
87
tls . connect ( {
86
88
port : this . address ( ) . port ,
87
89
key : [ rawKey ] ,
88
90
cert : [ cert ] ,
89
91
rejectUnauthorized : false
90
- } , common . mustCall ( ) ) ;
92
+ } , onSecureConnect ( ) ) ;
91
93
92
94
tls . connect ( {
93
95
port : this . address ( ) . port ,
94
96
key : [ rawKey ] ,
95
97
passphrase : 'ignored' ,
96
98
cert : [ cert ] ,
97
99
rejectUnauthorized : false
98
- } , common . mustCall ( ) ) ;
100
+ } , onSecureConnect ( ) ) ;
99
101
100
102
// string
101
103
tls . connect ( {
@@ -104,22 +106,22 @@ server.listen(0, common.mustCall(function() {
104
106
passphrase : 'password' ,
105
107
cert : cert . toString ( ) ,
106
108
rejectUnauthorized : false
107
- } , common . mustCall ( ) ) ;
109
+ } , onSecureConnect ( ) ) ;
108
110
109
111
tls . connect ( {
110
112
port : this . address ( ) . port ,
111
113
key : rawKey . toString ( ) ,
112
114
cert : cert . toString ( ) ,
113
115
rejectUnauthorized : false
114
- } , common . mustCall ( ) ) ;
116
+ } , onSecureConnect ( ) ) ;
115
117
116
118
tls . connect ( {
117
119
port : this . address ( ) . port ,
118
120
key : rawKey . toString ( ) ,
119
121
passphrase : 'ignored' ,
120
122
cert : cert . toString ( ) ,
121
123
rejectUnauthorized : false
122
- } , common . mustCall ( ) ) ;
124
+ } , onSecureConnect ( ) ) ;
123
125
124
126
// String[]
125
127
tls . connect ( {
@@ -128,97 +130,97 @@ server.listen(0, common.mustCall(function() {
128
130
passphrase : 'password' ,
129
131
cert : [ cert . toString ( ) ] ,
130
132
rejectUnauthorized : false
131
- } , common . mustCall ( ) ) ;
133
+ } , onSecureConnect ( ) ) ;
132
134
133
135
tls . connect ( {
134
136
port : this . address ( ) . port ,
135
137
key : [ rawKey . toString ( ) ] ,
136
138
cert : [ cert . toString ( ) ] ,
137
139
rejectUnauthorized : false
138
- } , common . mustCall ( ) ) ;
140
+ } , onSecureConnect ( ) ) ;
139
141
140
142
tls . connect ( {
141
143
port : this . address ( ) . port ,
142
144
key : [ rawKey . toString ( ) ] ,
143
145
passphrase : 'ignored' ,
144
146
cert : [ cert . toString ( ) ] ,
145
147
rejectUnauthorized : false
146
- } , common . mustCall ( ) ) ;
148
+ } , onSecureConnect ( ) ) ;
147
149
148
150
// Object[]
149
151
tls . connect ( {
150
152
port : this . address ( ) . port ,
151
153
key : [ { pem : passKey , passphrase : 'password' } ] ,
152
154
cert : cert ,
153
155
rejectUnauthorized : false
154
- } , common . mustCall ( ) ) ;
156
+ } , onSecureConnect ( ) ) ;
155
157
156
158
tls . connect ( {
157
159
port : this . address ( ) . port ,
158
160
key : [ { pem : passKey , passphrase : 'password' } ] ,
159
161
passphrase : 'ignored' ,
160
162
cert : cert ,
161
163
rejectUnauthorized : false
162
- } , common . mustCall ( ) ) ;
164
+ } , onSecureConnect ( ) ) ;
163
165
164
166
tls . connect ( {
165
167
port : this . address ( ) . port ,
166
168
key : [ { pem : passKey } ] ,
167
169
passphrase : 'password' ,
168
170
cert : cert ,
169
171
rejectUnauthorized : false
170
- } , common . mustCall ( ) ) ;
172
+ } , onSecureConnect ( ) ) ;
171
173
172
174
tls . connect ( {
173
175
port : this . address ( ) . port ,
174
176
key : [ { pem : passKey . toString ( ) , passphrase : 'password' } ] ,
175
177
cert : cert ,
176
178
rejectUnauthorized : false
177
- } , common . mustCall ( ) ) ;
179
+ } , onSecureConnect ( ) ) ;
178
180
179
181
tls . connect ( {
180
182
port : this . address ( ) . port ,
181
183
key : [ { pem : rawKey , passphrase : 'ignored' } ] ,
182
184
cert : cert ,
183
185
rejectUnauthorized : false
184
- } , common . mustCall ( ) ) ;
186
+ } , onSecureConnect ( ) ) ;
185
187
186
188
tls . connect ( {
187
189
port : this . address ( ) . port ,
188
190
key : [ { pem : rawKey . toString ( ) , passphrase : 'ignored' } ] ,
189
191
cert : cert ,
190
192
rejectUnauthorized : false
191
- } , common . mustCall ( ) ) ;
193
+ } , onSecureConnect ( ) ) ;
192
194
193
195
tls . connect ( {
194
196
port : this . address ( ) . port ,
195
197
key : [ { pem : rawKey } ] ,
196
198
passphrase : 'ignored' ,
197
199
cert : cert ,
198
200
rejectUnauthorized : false
199
- } , common . mustCall ( ) ) ;
201
+ } , onSecureConnect ( ) ) ;
200
202
201
203
tls . connect ( {
202
204
port : this . address ( ) . port ,
203
205
key : [ { pem : rawKey . toString ( ) } ] ,
204
206
passphrase : 'ignored' ,
205
207
cert : cert ,
206
208
rejectUnauthorized : false
207
- } , common . mustCall ( ) ) ;
209
+ } , onSecureConnect ( ) ) ;
208
210
209
211
tls . connect ( {
210
212
port : this . address ( ) . port ,
211
213
key : [ { pem : rawKey } ] ,
212
214
cert : cert ,
213
215
rejectUnauthorized : false
214
- } , common . mustCall ( ) ) ;
216
+ } , onSecureConnect ( ) ) ;
215
217
216
218
tls . connect ( {
217
219
port : this . address ( ) . port ,
218
220
key : [ { pem : rawKey . toString ( ) } ] ,
219
221
cert : cert ,
220
222
rejectUnauthorized : false
221
- } , common . mustCall ( ) ) ;
223
+ } , onSecureConnect ( ) ) ;
222
224
} ) ) . unref ( ) ;
223
225
224
226
const errMessagePassword = / b a d d e c r y p t / ;
0 commit comments