Class AbstractConnector

    • Field Detail

      • DEFAULT_MAX_REPLY_LENGTH

        protected static final int DEFAULT_MAX_REPLY_LENGTH
        Default maximum reply length. 256kB is the OpenSSH limit.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractConnector

        protected AbstractConnector​(int maxReplyLength)
        Creates a new instance.
        Parameters:
        maxReplyLength - maximum number of payload bytes we're ready to accept
    • Method Detail

      • getMaximumMessageLength

        protected int getMaximumMessageLength()
        Retrieves the maximum message length this AbstractConnector is configured for.
        Returns:
        the maximum message length
      • prepareMessage

        protected void prepareMessage​(byte command,
                                      byte[] message)
                               throws IllegalArgumentException
        Prepares a message for sending by inserting the command and message length.
        Parameters:
        command - SSH agent command the request is for
        message - about to be sent, including the 5 spare bytes at the front
        Throws:
        IllegalArgumentException - if message has less than 5 bytes
      • toLength

        protected int toLength​(byte command,
                               byte[] length)
                        throws IOException
        Checks the received length of a reply.
        Parameters:
        command - SSH agent command the reply is for
        length - length as received: number of payload bytes
        Returns:
        the length as an int
        Throws:
        IOException - if the length is invalid