kristofa/brave — pull request #28 by srapp (2014-07-21 15:38:32+00:00)
Title: Changed header encoding from toHexString() to toString()

We started noticing some NumberFormatExceptions showing up in our local development after pulling the changes from #26. Digging into it, it looks like we have some weirdness in Java to thank for that. Looking at the definition of [Long.toHexString()](http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#toHexString(long)), it makes an assumption that the long value provided is nonnegative, which isn't something we can guarantee. When a negative number is provided, the resulting encoded hex is generates too large of a number when parsed by [Long.parseLong()](http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#parseLong(java.lang.String,%20int)). Instead, it seems like we should use an overload of [Long.toString()](http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#toString(long,%20int)), specifying the radix of 16. I've updated a test to cover this corner case.