Add typechecking to Socket#pack to avoid parsing undefined

Fixes #124 provided we can make the tests work.

Signed-off-by: Eli Skeggs <eskeggs@globesherpa.com>