There's not really any reason to return a Java Socket from these APIs, especially given the lack of native socket marshalling capabilities in Java. We should instead just return Input/Output streams which wrap some native calls (via JNI) for the relevant functions, and implement the wrapper streams in Gosling.jar