If there is an unused socket instance but it is not closed.
Should jvm be gc this?
If so, will the tcp connection be automatically closed?
Garbage collection will invoke finalize() , which in turn closes the connection.
finalize()
See java.net.AbstractPlainSocketImpl :
java.net.AbstractPlainSocketImpl
protected void finalize() throws IOException { close(); }
Almost like magic.