Unit and spec tests with corrections to code

Added core/socket spec tests and core/ram/socket spec tests.