@@ -22,11 +22,14 @@ var constants = require('constants');
22
22
var fs = require ( 'fs' ) ;
23
23
var join = require ( 'path' ) . join ;
24
24
25
- test ( { response : false } , function ( ) {
26
- test ( { response : 'hello world' } , function ( ) {
27
- test ( { ocsp : false } ) ;
28
- } ) ;
29
- } ) ;
25
+ var pfx = fs . readFileSync ( join ( common . fixturesDir , 'keys' , 'agent1-pfx.pem' ) ) ;
26
+
27
+ var tests = [
28
+ { response : false } ,
29
+ { response : 'hello world' } ,
30
+ { ocsp : false } ,
31
+ { pfx : pfx , passphrase : 'sample' , response : 'hello pfx' }
32
+ ] ;
30
33
31
34
function test ( testOptions , cb ) {
32
35
@@ -47,6 +50,13 @@ function test(testOptions, cb) {
47
50
var ocspResponse ;
48
51
var session ;
49
52
53
+ if ( testOptions . pfx ) {
54
+ delete options . key ;
55
+ delete options . cert ;
56
+ options . pfx = testOptions . pfx ;
57
+ options . passphrase = testOptions . passphrase ;
58
+ }
59
+
50
60
var server = tls . createServer ( options , function ( cleartext ) {
51
61
cleartext . on ( 'error' , function ( er ) {
52
62
// We're ok with getting ECONNRESET in this test, but it's
@@ -60,6 +70,7 @@ function test(testOptions, cb) {
60
70
} ) ;
61
71
server . on ( 'OCSPRequest' , function ( cert , issuer , callback ) {
62
72
++ ocspCount ;
73
+ console . log ( cert , issuer ) ;
63
74
assert . ok ( Buffer . isBuffer ( cert ) ) ;
64
75
assert . ok ( Buffer . isBuffer ( issuer ) ) ;
65
76
@@ -106,3 +117,13 @@ function test(testOptions, cb) {
106
117
assert . equal ( ocspCount , 1 ) ;
107
118
} ) ;
108
119
}
120
+
121
+ function runTests ( i ) {
122
+ if ( i === tests . length ) return ;
123
+
124
+ test ( tests [ i ] , common . mustCall ( function ( ) {
125
+ runTests ( i + 1 ) ;
126
+ } ) ) ;
127
+ }
128
+
129
+ runTests ( 0 ) ;
0 commit comments