don't use require from within a method

especially as socket is required by default
Merge pull request #1 from joshk/patch-1

Move socket require to top-level