public void testWebSocketServer() {

    try {
      // randomly select two clients from the collection.
      for (int i = 0; i <= 1000; i++) {
        NettyTestClient from = clients.get(random.nextInt(clients.size()));
        NettyTestClient to = clients.get(random.nextInt(clients.size()));

        // this needs to be here when testing max size or max connections.
        if (to.isClosed()) {
          continue;
        }

        SocketMessage msg = messages.get(random.nextInt(messages.size()));
        msg.setText("Hola!");
        msg.setFrom(from.getUuid());
        msg.setTo(to.getUuid());
        msg.setDate(new Date());
        String json = JSONUtils.toJson(msg);
        from.send(json);

        Thread.sleep(TestConfig.getInstance().getMessageDelay());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public void buildSocketMessages() {
   if (this.messages.isEmpty()) {
     for (File file : loader.getFiles()) {
       SocketMessage msg = new SocketMessage();
       Map<String, Object> data = new HashMap<String, Object>();
       String filedata = loader.getData(file);
       data.put("sample.data", filedata);
       msg.setData(data);
       messages.add(msg);
     }
   }
 }