add client and server socket factory methods to Socket class

add client and server socket factory methods to Socket class, allowing plugins to customize this behavior