var assert = require('assert');
var baseErr = 'geteventstore-promise - TCP client - ';

module.exports = function(config) {
	//Assert configuration
	assert(config, baseErr + 'config not provided');
	assert(config.hostname, baseErr + 'hostname property not provided');
	assert(config.port, baseErr + 'port property not provided');
	assert(config.credentials, baseErr + 'credentials property not provided');
	assert(config.credentials.username, baseErr + 'credentials.username property not provided');
	assert(config.credentials.password, baseErr + 'credentials.password property not provided');

	//Add additional internal configuration properties
	config = JSON.parse(JSON.stringify(config));
	config.protocol = 'http';
	config.auth = config.credentials.username + ':' + config.credentials.password;

	return {
		writeEvent: require('./writeEvent')(config),
		writeEvents: require('./writeEvents')(config),
		getAllStreamEvents: require('./getAllStreamEvents')(config),
		getEvents: require('./getEvents')(config),
		getEventsByType: require('./getEventsByType')(config),
		eventEnumerator: require('./eventEnumerator')(config)
	};
};
var assert = require('assert');
var baseErr = 'geteventstore-promise - TCP client - ';

module.exports = function(config) {
	//Assert configuration
	assert(config, baseErr + 'config not provided');
	assert(config.hostname, baseErr + 'hostname property not provided');
	assert(config.port, baseErr + 'port property not provided');
	assert(config.credentials, baseErr + 'credentials property not provided');
	assert(config.credentials.username, baseErr + 'credentials.username property not provided');
	assert(config.credentials.password, baseErr + 'credentials.password property not provided');

	//Add additional internal configuration properties
	config = JSON.parse(JSON.stringify(config));
	config.protocol = 'tcp';
	config.auth = config.credentials.username + ':' + config.credentials.password;

	return {
		writeEvent: require('./writeEvent')(config),
		writeEvents: require('./writeEvents')(config),
		getAllStreamEvents: require('./getAllStreamEvents')(config),
		getEvents: require('./getEvents')(config),
		getEventsByType: require('./getEventsByType')(config),
		eventEnumerator: require('./eventEnumerator')(config)
	};
};
Fix protocol in tcp client
Fix protocol in tcp client
