Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

TorSocket.isConnected always returns false #19

Open
craigraw opened this issue Sep 14, 2020 · 0 comments
Open

TorSocket.isConnected always returns false #19

craigraw opened this issue Sep 14, 2020 · 0 comments

Comments

@craigraw
Copy link

TorSocket delegates the socket.isConnected() call to SocksSocket which always returns false, even when the TorSocket has successfully connected to the endpoint.

This is a problem when wrapping the TorSocket in a java SSLSocket, as the first thing that SSLSocketImpl does is check if the socket is connected:
if (!sock.isConnected()) { throw new SocketException("Underlying socket is not connected"); }

While it's unnecessary to wrap Tor connections in SSL, sometimes you don't get a choice of server protocol.

A workaround is to use Java reflection to retrieve SocksSocket from TorSocket and set the connected member variable to true.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant