Class AbstractClientChannel

    • Field Detail

      • opened

        protected final java.util.concurrent.atomic.AtomicBoolean opened
      • in

        protected java.io.InputStream in
      • invertedIn

        protected java.io.OutputStream invertedIn
      • out

        protected java.io.OutputStream out
      • invertedOut

        protected java.io.InputStream invertedOut
      • err

        protected java.io.OutputStream err
      • invertedErr

        protected java.io.InputStream invertedErr
      • exitStatusHolder

        protected final java.util.concurrent.atomic.AtomicReference<java.lang.Integer> exitStatusHolder
      • exitSignalHolder

        protected final java.util.concurrent.atomic.AtomicReference<java.lang.String> exitSignalHolder
      • openFailureReason

        protected int openFailureReason
      • openFailureMsg

        protected java.lang.String openFailureMsg
      • openFailureLang

        protected java.lang.String openFailureLang
      • channelType

        private final java.lang.String channelType
    • Constructor Detail

      • AbstractClientChannel

        protected AbstractClientChannel​(java.lang.String type)
      • AbstractClientChannel

        protected AbstractClientChannel​(java.lang.String type,
                                        java.util.Collection<? extends RequestHandler<Channel>> handlers)
    • Method Detail

      • addChannelSignalRequestHandlers

        protected void addChannelSignalRequestHandlers​(EventNotifier<java.lang.String> notifier)
      • getChannelType

        public java.lang.String getChannelType()
        Specified by:
        getChannelType in interface ClientChannel
        Returns:
        The type of channel reported when it was created
      • getInvertedIn

        public java.io.OutputStream getInvertedIn()
        Description copied from interface: ClientChannel
        Access to an output stream to send data directly to the remote channel. This can be used instead of using ClientChannel.setIn(java.io.InputStream) method and having the channel polling for data in that stream.
        Specified by:
        getInvertedIn in interface ClientChannel
        Returns:
        an OutputStream to be used to send data
      • getIn

        public java.io.InputStream getIn()
      • setIn

        public void setIn​(java.io.InputStream in)
        Description copied from interface: ClientChannel
        Set an input stream that will be read by this channel and forwarded to the remote channel. Note that using such a stream will create an additional thread for pumping the stream which will only be able to end when that stream is actually closed or some data is read. It is recommended to use the ClientChannel.getInvertedIn() method instead and write data directly.
        Specified by:
        setIn in interface ClientChannel
        Parameters:
        in - an InputStream to be polled and forwarded
      • getOut

        public java.io.OutputStream getOut()
      • setOut

        public void setOut​(java.io.OutputStream out)
        Specified by:
        setOut in interface ClientChannel
      • getErr

        public java.io.OutputStream getErr()
      • setErr

        public void setErr​(java.io.OutputStream err)
        Specified by:
        setErr in interface ClientChannel
      • updateCurrentChannelState

        protected <C extends java.util.Collection<ClientChannelEvent>> C updateCurrentChannelState​(C state)
      • open

        public OpenFuture open()
                        throws java.io.IOException
        Specified by:
        open in interface ClientChannel
        Throws:
        java.io.IOException
      • open

        public OpenFuture open​(int recipient,
                               long rwSize,
                               long packetSize,
                               Buffer buffer)
        Description copied from interface: Channel
        For a server channel, this method will actually open the channel
        Specified by:
        open in interface Channel
        Parameters:
        recipient - Recipient identifier
        rwSize - Read/Write window size (uint32)
        packetSize - Preferred maximum packet size (uint32)
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
        Returns:
        An OpenFuture for the channel open request
      • handleOpenSuccess

        public void handleOpenSuccess​(int recipient,
                                      long rwSize,
                                      long packetSize,
                                      Buffer buffer)
        Description copied from interface: Channel
        For a client channel, this method will be called internally by the session when the confirmation has been received.
        Specified by:
        handleOpenSuccess in interface Channel
        Parameters:
        recipient - Recipient identifier
        rwSize - Read/Write window size (uint32)
        packetSize - Preferred maximum packet size (uint32)
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
      • doOpen

        protected abstract void doOpen()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • handleOpenFailure

        public void handleOpenFailure​(Buffer buffer)
        Description copied from interface: Channel
        For a client channel, this method will be called internally by the session when the server has rejected this channel opening.
        Specified by:
        handleOpenFailure in interface Channel
        Parameters:
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
      • doWriteData

        protected void doWriteData​(byte[] data,
                                   int off,
                                   long len)
                            throws java.io.IOException
        Specified by:
        doWriteData in class AbstractChannel
        Throws:
        java.io.IOException
      • doWriteExtendedData

        protected void doWriteExtendedData​(byte[] data,
                                           int off,
                                           long len)
                                    throws java.io.IOException
        Specified by:
        doWriteExtendedData in class AbstractChannel
        Throws:
        java.io.IOException
      • handleWindowAdjust

        public void handleWindowAdjust​(Buffer buffer)
                                throws java.io.IOException
        Description copied from interface: Channel
        Invoked when SSH_MSG_CHANNEL_WINDOW_ADJUST received
        Specified by:
        handleWindowAdjust in interface Channel
        Overrides:
        handleWindowAdjust in class AbstractChannel
        Parameters:
        buffer - The rest of the message data Buffer after decoding the channel identifiers
        Throws:
        java.io.IOException - If failed to handle the message
      • getExitStatus

        public java.lang.Integer getExitStatus()
        Specified by:
        getExitStatus in interface ClientChannel
        Returns:
        The signaled exit status via "exit-status" request - null if not signaled
      • getExitSignal

        public java.lang.String getExitSignal()
        Specified by:
        getExitSignal in interface ClientChannel
        Returns:
        The signaled exit signal via "exit-signal" - null if not signaled