testing server side node code using mocha framework

I am testing my server side node code using mocha framework. I am testing my node code using following test file.

var app = express();
var options = {
    key: privateKey,
    cert: certificate
};
 server = https.createServer(options, app).listen(843, function() {
        console.log("Express server listening on port " + 843);
 });
var io = require('socket.io').listen(server);

describe('virtual classroom serverside testing', function(){
    before(function(){
        io.on('connect', function(){
            console.log('not displaying');
        });
    });
});

In this file I have not run any test case. But still the code gives following warning.

warn  - error raised: Error: listen EADDRINUSE

When I searched about this error, some resources mentioned that this error happen when another server is already running on the requested port. Then how can I run tests using mocha to test my server side code. Any kind of help would be appreciated.