sry, but I think you got something mixed up. This is not about Socket.java but ServerSocket.
I took a look, and it seems to be something else entirely. As I though ServerSocketChannel is the “new” NIO way to do it, but it doesn’t wrap the old ServerSocket. When you call the socket() method it returns a wrapper object of the Channel which behaves like an old ServerSocket.
So, use the first code snippet. The second one is only there for backwards compatibility. Like if you have to use code which needs the old ServerSocket, but you want to use the new ServerSocketChannel.