From 2fef6fd1fa809607c14f1634c1dec91e8fc84165 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 8 May 2018 11:26:28 +0100 Subject: [PATCH] Fix proper closing of http request test ssl/proxy servers --- test/nodes/core/io/21-httprequest_spec.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/nodes/core/io/21-httprequest_spec.js b/test/nodes/core/io/21-httprequest_spec.js index 76b0d8d32..2c0443dc2 100644 --- a/test/nodes/core/io/21-httprequest_spec.js +++ b/test/nodes/core/io/21-httprequest_spec.js @@ -68,11 +68,11 @@ describe('HTTP Request Node', function() { An optional company name []: */ }; - testSslServer = https.createServer(sslOptions,testApp); + testSslServer = stoppable(https.createServer(sslOptions,testApp)); testSslServer.listen(testSslPort); testProxyPort += 1; - testProxyServer = httpProxy.createProxyServer({target:'http://localhost:' + testPort}); + testProxyServer = stoppable(httpProxy.createProxyServer({target:'http://localhost:' + testPort})); testProxyServer.on('proxyReq', function(proxyReq, req, res, options) { proxyReq.setHeader('x-testproxy-header', 'foobar'); }); @@ -217,8 +217,11 @@ describe('HTTP Request Node', function() { after(function(done) { testServer.stop(() => { - testProxyServer.close(); - helper.stopServer(done); + testProxyServer.stop(() => { + testSslServer.stop(() => { + helper.stopServer(done); + }); + }); }); });