/* Global Includes */
var testCase   = require('mocha').describe;
var pre        = require('mocha').before;
var preEach    = require('mocha').beforeEach;
var post       = require('mocha').after;
var postEach   = require('mocha').afterEach;
var assertions = require('mocha').it;
var assert     = require('chai').assert;
var validator  = require('validator');
var exec       = require('child_process').execSync;
var artik      = require('../lib/artik-sdk');


/* Test Specific Includes */
var websocket         = require('../src/websocket');
var auth_token        = process.env.AUTH_TOKEN;
var device_id         = process.env.DEVICE_ID;
var message_data      = process.env.MESSAGE_DATA;
var host              = "api.artik.cloud";
var uri               = "/v1.1/websocket?ack=true";
var port              = 443;
var ssl_connection    = 2;
var use_se            = false;
var register_message  = '{"sdid":"' + device_id + '","Authorization":"bearer ' + auth_token + '","type":"register"}';
var test_send_message = '{\"data\": ' + message_data + ',"sdid": "' + device_id +  '","type": "message"}';

var conn = new websocket(host, uri, port, ssl_connection, use_se);

/* Test Case Module */
testCase('Websockets', function() {

	this.timeout(10000);

	pre(function() {

		conn = new websocket(host, uri, port, ssl_connection, use_se);

	});

	testCase('#open_stream(), on(connected)', function() {

		assertions('Return callback event when the websocket is connected', function(done) {

			conn.on('connected', function(result) {
				console.log("Connect result: " + result);
				assert.equal(result, "CONNECTED");
				done();
			});

			conn.open_stream();
		});

	});

	testCase('#write_stream(), on(receive)', function() {

		assertions('Return callback event when the data is received', function(done) {

			conn.on('receive', function(message) {
				console.log("received: " + message);
				assert.isNotNull(message);
				done();
			});

			conn.write_stream(register_message);
		});

	});

	post(function() {
	});

});

@@ -632,58 +632,8 @@
 ID;%0A
-var message_data      = process.env.MESSAGE_DATA;%0A
 var 
@@ -931,115 +931,8 @@
 %22%7D';
-%0Avar test_send_message = '%7B%5C%22data%5C%22: ' + message_data + ',%22sdid%22: %22' + device_id +  '%22,%22type%22: %22message%22%7D';
 %0A%0Ava
@@ -1748,24 +1748,138 @@
 l(message);%0A
+%09%09%09%09assert.equal(JSON.parse(message).data.code, %22200%22);%0A%09%09%09%09assert.equal(JSON.parse(message).data.message, %22OK%22);%0A
 %09%09%09%09done();%0A

Add verification of received message