<commit_before>// var LimitdServer = require('..').Server;

// var Socket = require('net').Socket;
// var rimraf = require('rimraf');
// var _ = require('lodash');
// var path = require('path')

// describe('wrong requests', function () {
//   var server, address;

//   before(function (done) {
//     var db_file = path.join(__dirname, 'dbs', 'unexpected_conditions.db');
//     try{
//       rimraf.sync(db_file);
//     } catch(err){}

//     server = new LimitdServer(_.extend({db: db_file}, require('./fixture')));

//     server.start(function (err, addr) {
//       if (err) return done(err);
//       address = addr;
//       done();
//     });
//   });

//   after(function () {
//     server.stop();
//   });

//   it('should disconnect the socket on unknown message', function (done) {
//     var socket = new Socket();
//     var ResponseMessage  = require('../messages').Response;
//     // I'm going to make the server fail by sending a Response message from the client.
//     socket.connect(address.port, address.address)
//       .once('connect', function () {
//         socket.write(new ResponseMessage({
//           request_id: '123',
//           type: ResponseMessage.Type.TAKE
//         }).encodeDelimited().toBuffer());
//       }).once('close', function () {
//         done();
//       });

//   });

// });<commit_msg>fix wrong requests tests<commit_after>var BaaSServer = require('..').Server;

var Socket = require('net').Socket;

describe('wrong requests', function () {
  var server, address;

  before(function (done) {

    server = new BaaSServer();

    server.start(function (err, addr) {
      if (err) return done(err);
      address = addr;
      done();
    });
  });

  after(function () {
    server.stop();
  });

  it('should disconnect the socket on unknown message', function (done) {
    var socket = new Socket();
    var ResponseMessage  = require('../messages').Response;
    // I'm going to make the server fail by sending a Response message from the client.
    socket.connect(address.port, address.address)
      .once('connect', function () {
        socket.write(new ResponseMessage({
          request_id: '123',
        }).encodeDelimited().toBuffer());
      }).once('close', function () {
        done();
      });

  });

});
{'fraction_non_alphanumeric': 0.18575174825174826, 'fraction_numerical': 0.0026223776223776225, 'mean_word_length': 2.4629349470499244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6786632', 'n_tokens_mistral': 690, 'n_tokens_neox': 667, 'n_words': 168}