You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
816 B
36 lines
816 B
var common = require('../../common');
|
|
var connection = common.createConnection({port: common.fakeServerPort});
|
|
var assert = require('assert');
|
|
|
|
var endErr;
|
|
connection.on('end', function(err) {
|
|
assert.ok(!endErr);
|
|
endErr = err;
|
|
});
|
|
|
|
var queryErr;
|
|
|
|
var server = common.createFakeServer();
|
|
server.listen(common.fakeServerPort, function(err) {
|
|
if (err) throw err;
|
|
|
|
connection.query('SELECT 1', function(err) {
|
|
assert.ok(!queryErr);
|
|
queryErr = err;
|
|
});
|
|
});
|
|
|
|
server.on('connection', function(connection) {
|
|
connection.handshake();
|
|
|
|
connection.on('query', function(packet) {
|
|
server.destroy();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.strictEqual(queryErr.code, 'PROTOCOL_CONNECTION_LOST');
|
|
assert.strictEqual(queryErr.fatal, true);
|
|
|
|
assert.strictEqual(endErr, queryErr);
|
|
});
|