Rebase #16.

This is a rebase of #16.
In additional I adapted the code to current mruby-uv and added tests.