Interface Connector
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractConnector,PageantConnector,UnixDomainSocketConnector,WinPipeConnector
Simple interface for connecting to something and making RPC-style
request-reply calls.
- Since:
- 6.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanconnect()Connects to an SSH agent if there is one running.default byte[]rpc(byte command) Performs a remote call sending only a command without any parameters to the SSH agent and returns the result.byte[]rpc(byte command, byte[] message) Performs a remote call to the SSH agent and returns the result.
-
Method Details
-
connect
Connects to an SSH agent if there is one running. If called when already connected just returnstrue.- Returns:
trueif an SSH agent is available and connected, if no SSH agent is available- Throws:
IOException- if connecting to the SSH agent failed
-
rpc
Performs a remote call to the SSH agent and returns the result.- Parameters:
command- to sendmessage- to send; must have at least 5 bytes, and must have 5 unused bytes at the front.- Returns:
- the result received
- Throws:
IOException- if an error occurs
-
rpc
Performs a remote call sending only a command without any parameters to the SSH agent and returns the result.- Parameters:
command- to send- Returns:
- the result received
- Throws:
IOException- if an error occurs
-