Android compatible (based on coap-13 branch)

As per Issue #16 

@mkovatsc

I have created a separate branch for android- compatibility in my fork. I suppose it would be ideal to have a separate Android branch in the original too.

I am sending the pull request on the coap-13 branch - but if this is too much of a hassle for you, please create a branch for Android and I shall re-send this pull request against that branch.