Interface Connector

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractConnector, PageantConnector, UnixDomainSocketConnector, WinPipeConnector

public interface Connector extends Closeable
Simple interface for connecting to something and making RPC-style request-reply calls.
Since:
6.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • connect

      boolean connect() throws IOException
      Connects to an SSH agent if there is one running. If called when already connected just returns true.
      Returns:
      true if an SSH agent is available and connected, if no SSH agent is available
      Throws:
      IOException - if connecting to the SSH agent failed
    • rpc

      byte[] rpc(byte command, byte[] message) throws IOException
      Performs a remote call to the SSH agent and returns the result.
      Parameters:
      command - to send
      message - 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

      default byte[] rpc(byte command) throws IOException
      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