File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,19 @@ const common = require('../common');
2525if ( ! common . hasCrypto )
2626 common . skip ( 'missing crypto' ) ;
2727
28- const tls = require ( 'tls' ) ;
29-
3028const net = require ( 'net' ) ;
29+ const tls = require ( 'tls' ) ;
30+ const fixtures = require ( '../common/fixtures' ) ;
3131
32- const socket = net . connect ( 443 , 'www.example.org' , common . mustCall ( ( ) => {
33- const secureSocket = tls . connect ( { socket } , common . mustCall ( ( ) => {
34- secureSocket . destroy ( ) ;
35- console . log ( 'ok' ) ;
32+ const server = tls . createServer ( {
33+ key : fixtures . readKey ( 'agent1-key.pem' ) ,
34+ cert : fixtures . readKey ( 'agent1-cert.pem' )
35+ } ) . listen ( 0 , common . mustCall ( ( ) => {
36+ const socket = net . connect ( server . address ( ) . port , common . mustCall ( ( ) => {
37+ const opts = { socket, rejectUnauthorized : false } ;
38+ const secureSocket = tls . connect ( opts , common . mustCall ( ( ) => {
39+ secureSocket . destroy ( ) ;
40+ server . close ( ) ;
41+ } ) ) ;
3642 } ) ) ;
3743} ) ) ;
You can’t perform that action at this time.
0 commit comments