@@ -37,15 +37,17 @@ assert(Buffer.isBuffer(cert));
3737assert . strictEqual ( typeof passKey . toString ( ) , 'string' ) ;
3838assert . strictEqual ( typeof cert . toString ( ) , 'string' ) ;
3939
40+ function onSecureConnect ( ) {
41+ return common . mustCall ( function ( ) { this . end ( ) ; } ) ;
42+ }
43+
4044const server = tls . Server ( {
4145key : passKey ,
4246passphrase : 'password' ,
4347cert : cert ,
4448ca : [ cert ] ,
4549requestCert : true ,
4650rejectUnauthorized : true
47- } , function ( s ) {
48- s . end ( ) ;
4951} ) ;
5052
5153server . listen ( 0 , common . mustCall ( function ( ) {
@@ -56,22 +58,22 @@ server.listen(0, common.mustCall(function(){
5658passphrase : 'password' ,
5759cert : cert ,
5860rejectUnauthorized : false
59- } , common . mustCall ( ) ) ;
61+ } , onSecureConnect ( ) ) ;
6062
6163tls . connect ( {
6264port : this . address ( ) . port ,
6365key : rawKey ,
6466cert : cert ,
6567rejectUnauthorized : false
66- } , common . mustCall ( ) ) ;
68+ } , onSecureConnect ( ) ) ;
6769
6870tls . connect ( {
6971port : this . address ( ) . port ,
7072key : rawKey ,
7173passphrase : 'ignored' ,
7274cert : cert ,
7375rejectUnauthorized : false
74- } , common . mustCall ( ) ) ;
76+ } , onSecureConnect ( ) ) ;
7577
7678// Buffer[]
7779tls . connect ( {
@@ -80,22 +82,22 @@ server.listen(0, common.mustCall(function(){
8082passphrase : 'password' ,
8183cert : [ cert ] ,
8284rejectUnauthorized : false
83- } , common . mustCall ( ) ) ;
85+ } , onSecureConnect ( ) ) ;
8486
8587tls . connect ( {
8688port : this . address ( ) . port ,
8789key : [ rawKey ] ,
8890cert : [ cert ] ,
8991rejectUnauthorized : false
90- } , common . mustCall ( ) ) ;
92+ } , onSecureConnect ( ) ) ;
9193
9294tls . connect ( {
9395port : this . address ( ) . port ,
9496key : [ rawKey ] ,
9597passphrase : 'ignored' ,
9698cert : [ cert ] ,
9799rejectUnauthorized : false
98- } , common . mustCall ( ) ) ;
100+ } , onSecureConnect ( ) ) ;
99101
100102// string
101103tls . connect ( {
@@ -104,22 +106,22 @@ server.listen(0, common.mustCall(function(){
104106passphrase : 'password' ,
105107cert : cert . toString ( ) ,
106108rejectUnauthorized : false
107- } , common . mustCall ( ) ) ;
109+ } , onSecureConnect ( ) ) ;
108110
109111tls . connect ( {
110112port : this . address ( ) . port ,
111113key : rawKey . toString ( ) ,
112114cert : cert . toString ( ) ,
113115rejectUnauthorized : false
114- } , common . mustCall ( ) ) ;
116+ } , onSecureConnect ( ) ) ;
115117
116118tls . connect ( {
117119port : this . address ( ) . port ,
118120key : rawKey . toString ( ) ,
119121passphrase : 'ignored' ,
120122cert : cert . toString ( ) ,
121123rejectUnauthorized : false
122- } , common . mustCall ( ) ) ;
124+ } , onSecureConnect ( ) ) ;
123125
124126// String[]
125127tls . connect ( {
@@ -128,97 +130,97 @@ server.listen(0, common.mustCall(function(){
128130passphrase : 'password' ,
129131cert : [ cert . toString ( ) ] ,
130132rejectUnauthorized : false
131- } , common . mustCall ( ) ) ;
133+ } , onSecureConnect ( ) ) ;
132134
133135tls . connect ( {
134136port : this . address ( ) . port ,
135137key : [ rawKey . toString ( ) ] ,
136138cert : [ cert . toString ( ) ] ,
137139rejectUnauthorized : false
138- } , common . mustCall ( ) ) ;
140+ } , onSecureConnect ( ) ) ;
139141
140142tls . connect ( {
141143port : this . address ( ) . port ,
142144key : [ rawKey . toString ( ) ] ,
143145passphrase : 'ignored' ,
144146cert : [ cert . toString ( ) ] ,
145147rejectUnauthorized : false
146- } , common . mustCall ( ) ) ;
148+ } , onSecureConnect ( ) ) ;
147149
148150// Object[]
149151tls . connect ( {
150152port : this . address ( ) . port ,
151153key : [ { pem : passKey , passphrase : 'password' } ] ,
152154cert : cert ,
153155rejectUnauthorized : false
154- } , common . mustCall ( ) ) ;
156+ } , onSecureConnect ( ) ) ;
155157
156158tls . connect ( {
157159port : this . address ( ) . port ,
158160key : [ { pem : passKey , passphrase : 'password' } ] ,
159161passphrase : 'ignored' ,
160162cert : cert ,
161163rejectUnauthorized : false
162- } , common . mustCall ( ) ) ;
164+ } , onSecureConnect ( ) ) ;
163165
164166tls . connect ( {
165167port : this . address ( ) . port ,
166168key : [ { pem : passKey } ] ,
167169passphrase : 'password' ,
168170cert : cert ,
169171rejectUnauthorized : false
170- } , common . mustCall ( ) ) ;
172+ } , onSecureConnect ( ) ) ;
171173
172174tls . connect ( {
173175port : this . address ( ) . port ,
174176key : [ { pem : passKey . toString ( ) , passphrase : 'password' } ] ,
175177cert : cert ,
176178rejectUnauthorized : false
177- } , common . mustCall ( ) ) ;
179+ } , onSecureConnect ( ) ) ;
178180
179181tls . connect ( {
180182port : this . address ( ) . port ,
181183key : [ { pem : rawKey , passphrase : 'ignored' } ] ,
182184cert : cert ,
183185rejectUnauthorized : false
184- } , common . mustCall ( ) ) ;
186+ } , onSecureConnect ( ) ) ;
185187
186188tls . connect ( {
187189port : this . address ( ) . port ,
188190key : [ { pem : rawKey . toString ( ) , passphrase : 'ignored' } ] ,
189191cert : cert ,
190192rejectUnauthorized : false
191- } , common . mustCall ( ) ) ;
193+ } , onSecureConnect ( ) ) ;
192194
193195tls . connect ( {
194196port : this . address ( ) . port ,
195197key : [ { pem : rawKey } ] ,
196198passphrase : 'ignored' ,
197199cert : cert ,
198200rejectUnauthorized : false
199- } , common . mustCall ( ) ) ;
201+ } , onSecureConnect ( ) ) ;
200202
201203tls . connect ( {
202204port : this . address ( ) . port ,
203205key : [ { pem : rawKey . toString ( ) } ] ,
204206passphrase : 'ignored' ,
205207cert : cert ,
206208rejectUnauthorized : false
207- } , common . mustCall ( ) ) ;
209+ } , onSecureConnect ( ) ) ;
208210
209211tls . connect ( {
210212port : this . address ( ) . port ,
211213key : [ { pem : rawKey } ] ,
212214cert : cert ,
213215rejectUnauthorized : false
214- } , common . mustCall ( ) ) ;
216+ } , onSecureConnect ( ) ) ;
215217
216218tls . connect ( {
217219port : this . address ( ) . port ,
218220key : [ { pem : rawKey . toString ( ) } ] ,
219221cert : cert ,
220222rejectUnauthorized : false
221- } , common . mustCall ( ) ) ;
223+ } , onSecureConnect ( ) ) ;
222224} ) ) . unref ( ) ;
223225
224226const errMessagePassword = / b a d d e c r y p t / ;
0 commit comments