Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socks5DatagramSocket fails to redefine connect #20

Open
pelzvieh opened this issue Jul 17, 2019 · 0 comments
Open

Socks5DatagramSocket fails to redefine connect #20

pelzvieh opened this issue Jul 17, 2019 · 0 comments

Comments

@pelzvieh
Copy link

When trying to use DatagramSocket.connect on a derived Socks5DatagramSocket, you will run into IllegalArgumentException "connected address and packet address differ". This is because the connect method is not overloaded to connect to the relayInetSocketAddress. This way, the socket is actually connected to the final destination address, leading to an address conflict with the encapsulated DatagramPacket.
To fix, overload connect() to transparently connect to relayInetSocketAddress instead. Additionally, you should store the InetSocketAddress given to connect by the caller and check equals in the overloaded send methods.

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

No branches or pull requests

1 participant