Add a way to get the connection addresses#487
Merged
kruton merged 1 commit intoconnectbot:mainfrom Apr 23, 2026
Merged
Conversation
f75a7f4 to
d7a41c7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds access to the underlying connection’s local and remote socket addresses (for ConnectBot connectivity tracking) and wires those addresses into ConnectionInfo, with accompanying unit/integration tests.
Changes:
- Add
Connection#getLocalSocketAddress()/getRemoteSocketAddress()APIs backed byTransportManager. - Store local/remote socket addresses on
ConnectionInfoduring key exchange completion. - Add unit and OpenSSH integration tests covering the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/trilead/ssh2/Connection.java | Exposes local/remote socket addresses via new public methods. |
| src/main/java/com/trilead/ssh2/transport/TransportManager.java | Provides socket address accessors from the underlying Socket. |
| src/main/java/com/trilead/ssh2/transport/KexManager.java | Populates socket address fields into ConnectionInfo on NEWKEYS. |
| src/main/java/com/trilead/ssh2/ConnectionInfo.java | Adds localSocketAddress and remoteSocketAddress fields. |
| src/test/java/com/trilead/ssh2/ConnectionTest.java | Adds unit tests for “not connected” error behavior. |
| src/test/java/com/trilead/ssh2/OpenSSHCompatibilityTest.java | Adds integration test validating socket address access and propagation to ConnectionInfo. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d7a41c7 to
a9445cf
Compare
The local and remote socket address is used for tracking connectivity in ConnectBot.
a9445cf to
526e3a7
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The local and remote socket address is used for tracking connectivity in ConnectBot.