@@ -16,27 +16,29 @@ var options = {
1616 cert : fs . readFileSync ( common . fixturesDir + '/keys/agent1-cert.pem' )
1717} ;
1818
19- var server = tls . createServer ( options , function ( c ) {
20- setTimeout ( function ( ) {
21- c . write ( 'hello' ) ;
22- setTimeout ( function ( ) {
23- c . destroy ( ) ;
24- server . close ( ) ;
25- } , 150 ) ;
26- } , 150 ) ;
27- } ) ;
28-
29- server . listen ( 0 , function ( ) {
30- var socket = net . connect ( this . address ( ) . port , function ( ) {
31- var s = socket . setTimeout ( common . platformTimeout ( 240 ) , function ( ) {
32- throw new Error ( 'timeout' ) ;
33- } ) ;
34- assert . ok ( s instanceof net . Socket ) ;
19+ var server = tls . createServer ( options , common . mustCall ( ( c ) => {
20+ console . log ( 'Server connected' ) ;
21+ } ) ) ;
3522
23+ server . listen ( 0 , common . mustCall ( ( ) => {
24+ var socket = net . connect ( server . address ( ) . port , function ( ) {
25+ console . log ( 'Client connected' ) ;
3626 var tsocket = tls . connect ( {
3727 socket : socket ,
3828 rejectUnauthorized : false
3929 } ) ;
4030 tsocket . resume ( ) ;
31+ setTimeout ( common . mustCall ( ( ) => {
32+ tsocket . write ( 'hello' ) ;
33+ setTimeout ( common . mustCall ( ( ) => {
34+ tsocket . destroy ( ) ;
35+ server . close ( ) ;
36+ } ) , common . platformTimeout ( 150 ) ) ;
37+ } ) , common . platformTimeout ( 150 ) ) ;
38+
39+ var s = socket . setTimeout ( common . platformTimeout ( 240 ) , function ( ) {
40+ throw new Error ( 'timeout' ) ;
41+ } ) ;
42+ assert . ok ( s instanceof net . Socket ) ;
4143 } ) ;
42- } ) ;
44+ } ) ) ;
0 commit comments