dustismo/TrendrrNSQClient — pull request #10 by kenshiro-o (2014-04-15 15:42:29+00:00)
Title: Fix Null Pointer Exception in NSQConsumer

The code in the NSQConsumer.java does not check for a null Connection being returned from the call to
```
super.createConnection(address, port)
```

This PR fixes this issue which is manifested when we try to call a method on a null Connection (e.g. https://github.com/dustismo/TrendrrNSQClient/blob/master/src/main/java/com/trendrr/nsq/NSQConsumer.java#L39).

Moreover, some refactoring was done and tests added. In case you are interested, the stack trace looked as follows:
```
at com.trendrr.nsq.NSQConsumer.createConnection(NSQConsumer.java:40)
at com.trendrr.nsq.AbstractNSQClient.connect(AbstractNSQClient.java:183)
at com.trendrr.nsq.AbstractNSQClient$1.run(AbstractNSQClient.java:75)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
```