{"action":"created","issue":{"url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/8","labels_url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/8/comments","events_url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/8/events","html_url":"https://github.com/gitterHQ/irc-bridge/pull/8","id":60188162,"number":8,"title":"Modified Server for injectable adapter and better testability","user":{"login":"jimschubert","id":109659,"avatar_url":"https://avatars.githubusercontent.com/u/109659?v=3","gravatar_id":"","url":"https://api.github.com/users/jimschubert","html_url":"https://github.com/jimschubert","followers_url":"https://api.github.com/users/jimschubert/followers","following_url":"https://api.github.com/users/jimschubert/following{/other_user}","gists_url":"https://api.github.com/users/jimschubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jimschubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimschubert/subscriptions","organizations_url":"https://api.github.com/users/jimschubert/orgs","repos_url":"https://api.github.com/users/jimschubert/repos","events_url":"https://api.github.com/users/jimschubert/events{/privacy}","received_events_url":"https://api.github.com/users/jimschubert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-07T03:28:31Z","updated_at":"2015-03-09T11:01:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/gitterHQ/irc-bridge/pulls/8","html_url":"https://github.com/gitterHQ/irc-bridge/pull/8","diff_url":"https://github.com/gitterHQ/irc-bridge/pull/8.diff","patch_url":"https://github.com/gitterHQ/irc-bridge/pull/8.patch"},"body":"I made some modifications to the Server object to allow for injecting adapters. I changed the one test in `server_test.js` to assert on a single connected client. To make the tests repeatable, I had to expose the net.Server object from within `Server` so it could get closed down after the test suite ran.\r\n\r\nI was going to add a test for the injectable adapter, but I'm not sure of the best way to go about this since `adapter` isn't stored on client. I'd imagine `Client` is the meant to be actual bridge (socket+Adapter) and it would be safe and intuitive to add the Adapter to the instance. This would also allow for cleanup of the adapter in the `client#disconnected`  callback of `Server#connectionListener`. I could be missing something, but don't the adapters currently create a memory leak in `gitter-adapter.js`?  `subscribeToRoom` takes a room object onto which multiple events are bound with functions bound to the instance of the adapter.  Setting the adapter to null in connectionListener doesn't remove listeners on the adapter from those room events.  I'd expect messages after a client disconnects to continue being processed and this will throw an object is undefined exception:\r\n\r\n```\r\n// gitter-adapter.js line 112\r\nc.send(mask, 'PRIVMSG', '#' + room.uri, ':' + text);\r\n```\r\n\r\nI could go about fixing these things, I just wanted to open a discussion to make sure I wasn't wrong since I don't have a local gitter server that I can test the assumptions against."},"comment":{"url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/comments/77834197","html_url":"https://github.com/gitterHQ/irc-bridge/pull/8#issuecomment-77834197","issue_url":"https://api.github.com/repos/gitterHQ/irc-bridge/issues/8","id":77834197,"user":{"login":"suprememoocow","id":594566,"avatar_url":"https://avatars.githubusercontent.com/u/594566?v=3","gravatar_id":"","url":"https://api.github.com/users/suprememoocow","html_url":"https://github.com/suprememoocow","followers_url":"https://api.github.com/users/suprememoocow/followers","following_url":"https://api.github.com/users/suprememoocow/following{/other_user}","gists_url":"https://api.github.com/users/suprememoocow/gists{/gist_id}","starred_url":"https://api.github.com/users/suprememoocow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suprememoocow/subscriptions","organizations_url":"https://api.github.com/users/suprememoocow/orgs","repos_url":"https://api.github.com/users/suprememoocow/repos","events_url":"https://api.github.com/users/suprememoocow/events{/privacy}","received_events_url":"https://api.github.com/users/suprememoocow/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T11:01:34Z","updated_at":"2015-03-09T11:01:34Z","body":":+1: Awesome! First PR for the project. Thanks @jimschubert!"}}