@@ -29,6 +29,9 @@ if (!common.opensslCli)
29
29
if ( ! common . hasCrypto )
30
30
common . skip ( 'missing crypto' ) ;
31
31
32
+ if ( common . isWindows )
33
+ common . skip ( 'test does not work on Windows' ) ; // ...but it should!
34
+
32
35
const net = require ( 'net' ) ;
33
36
const assert = require ( 'assert' ) ;
34
37
const fixtures = require ( '../common/fixtures' ) ;
@@ -54,14 +57,14 @@ function test2() {
54
57
test ( 'keys/agent4-key.pem' , 'keys/agent4-cert.pem' , check ) ;
55
58
}
56
59
57
- function test ( keyfn , certfn , check , next ) {
58
- const key = fixtures . readSync ( keyfn ) . toString ( ) ;
59
- const cert = fixtures . readSync ( certfn ) . toString ( ) ;
60
+ function test ( keyPath , certPath , check , next ) {
61
+ const key = fixtures . readSync ( keyPath ) . toString ( ) ;
62
+ const cert = fixtures . readSync ( certPath ) . toString ( ) ;
60
63
61
64
const server = spawn ( common . opensslCli , [ 's_server' ,
62
65
'-accept' , common . PORT ,
63
- '-cert' , certfn ,
64
- '-key' , keyfn ] ) ;
66
+ '-cert' , fixtures . path ( certPath ) ,
67
+ '-key' , fixtures . path ( keyPath ) ] ) ;
65
68
server . stdout . pipe ( process . stdout ) ;
66
69
server . stderr . pipe ( process . stdout ) ;
67
70
@@ -72,7 +75,7 @@ function test(keyfn, certfn, check, next) {
72
75
server . stdout . setEncoding ( 'utf8' ) ;
73
76
server . stdout . on ( 'data' , function ( s ) {
74
77
serverStdoutBuffer += s ;
75
- console . error ( state ) ;
78
+ console . log ( state ) ;
76
79
switch ( state ) {
77
80
case 'WAIT-ACCEPT' :
78
81
if ( / A C C E P T / . test ( serverStdoutBuffer ) ) {
@@ -132,6 +135,11 @@ function test(keyfn, certfn, check, next) {
132
135
133
136
s . on ( 'connect' , function ( ) {
134
137
console . log ( 'client connected' ) ;
138
+ setTimeout ( function ( ) {
139
+ pair . cleartext . write ( 'hello\r\n' , function ( ) {
140
+ gotWriteCallback = true ;
141
+ } ) ;
142
+ } , 500 ) ;
135
143
} ) ;
136
144
137
145
pair . on ( 'secure' , function ( ) {
@@ -141,11 +149,6 @@ function test(keyfn, certfn, check, next) {
141
149
console . log ( 'client pair.cleartext.getCipher(): %j' ,
142
150
pair . cleartext . getCipher ( ) ) ;
143
151
if ( check ) check ( pair ) ;
144
- setTimeout ( function ( ) {
145
- pair . cleartext . write ( 'hello\r\n' , function ( ) {
146
- gotWriteCallback = true ;
147
- } ) ;
148
- } , 500 ) ;
149
152
} ) ;
150
153
151
154
pair . cleartext . on ( 'data' , function ( d ) {
0 commit comments