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');
25
25
if ( ! common . hasCrypto )
26
26
common . skip ( 'missing crypto' ) ;
27
27
28
- const tls = require ( 'tls' ) ;
29
-
30
28
const net = require ( 'net' ) ;
29
+ const tls = require ( 'tls' ) ;
30
+ const fixtures = require ( '../common/fixtures' ) ;
31
31
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
+ } ) ) ;
36
42
} ) ) ;
37
43
} ) ) ;
You canβt perform that action at this time.
0 commit comments