<commit_before>var should = require('should');
var uuid   = require('node-uuid');
var actionheroPrototype = require(__dirname + '/../../actionhero.js').actionheroPrototype;
var actionhero = new actionheroPrototype();
var api;

var net = require('net');
var client = {};
var client2 = {};
var client3 = {};

var clientDetails = {};
var client2Details = {};

function makeSocketRequest(thisClient, message, cb){
  var lines = [];
  var counter = 0;

  var rsp = function(d){
    d.split('\n').forEach(function(l){
      lines.push(l);
    });
    lines.push()
  };

  var respoder = function(){
    if(lines.length === 0 && counter < 100){
      counter++;
      return setTimeout(respoder, 10);
    }

    var lastLine = lines[(lines.length - 1)];
    if(lastLine === ''){ lastLine = lines[(lines.length - 2)] }
    var parsed = null;
    try { parsed = JSON.parse(lastLine) } catch(e){}
    thisClient.removeListener('data', rsp);
    if(typeof cb === 'function'){ cb(parsed) }
  }

  setTimeout(respoder, 10);

  thisClient.on('data', rsp);
  thisClient.write(message + '\r\n');
}

var connectClients = function(callback){
  setTimeout(function(){
    callback();
  }, 1000);

  client = net.connect(api.config.servers.socket.port, function(){
    client.setEncoding('utf8');
  });
  client2 = net.connect(api.config.servers.socket.port, function(){
    client2.setEncoding('utf8');
  });
  client3 = net.connect(api.config.servers.socket.port, function(){
    client3.setEncoding('utf8');
  });
}

describe('Server: Socket', function(){

  before(function(done){
    actionhero.start(function(err, a){
      api = a;
      connectClients(done)<commit_msg>tweak timing for travis<commit_after>var should = require('should');
var uuid   = require('node-uuid');
var actionheroPrototype = require(__dirname + '/../../actionhero.js').actionheroPrototype;
var actionhero = new actionheroPrototype();
var api;

var net = require('net');
var client = {};
var client2 = {};
var client3 = {};

var clientDetails = {};
var client2Details = {};

function makeSocketRequest(thisClient, message, cb){
  var lines = [];
  var counter = 0;

  var rsp = function(d){
    d.split('\n').forEach(function(l){
      lines.push(l);
    });
    lines.push()
  };

  var respoder = function(){
    if(lines.length === 0 && counter < 20){
      counter++;
      return setTimeout(respoder, 10);
    }

    var lastLine = lines[(lines.length - 1)];
    if(lastLine === ''){ lastLine = lines[(lines.length - 2)] }
    var parsed = null;
    try { parsed = JSON.parse(lastLine) } catch(e){}
    thisClient.removeListener('data', rsp);
    if(typeof cb === 'function'){ cb(parsed) }
  }

  setTimeout(respoder, 50);

  thisClient.on('data', rsp);
  thisClient.write(message + '\r\n');
}

var connectClients = function(callback){
  setTimeout(function(){
    callback();
  }, 1000);

  client = net.connect(api.config.servers.socket.port, function(){
    client.setEncoding('utf8');
  });
  client2 = net.connect(api.config.servers.socket.port, function(){
    client2.setEncoding('utf8');
  });
  client3 = net.connect(api.config.servers.socket.port, function(){
    client3.setEncoding('utf8');
  });
}

describe('Server: Socket', function(){

  before(function(done){
    actionhero.start(function(err, a){
      api = a;
      connectClients(done)
{'fraction_non_alphanumeric': 0.17875413782726451, 'fraction_numerical': 0.014745711706289497, 'mean_word_length': 3.721590909090909, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7450333', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1064, 'n_words': 220}