Class ProxyImpl

  • All Implemented Interfaces:
    Proxy, org.apache.qpid.proton.engine.impl.TransportLayer

    public class ProxyImpl
    extends Object
    implements Proxy, org.apache.qpid.proton.engine.impl.TransportLayer
    Implementation class that handles connecting to, the status of, and passing bytes through the web socket after the proxy is created.
    See Also:
    Proxy, ProxyHandler
    • Constructor Detail

      • ProxyImpl

        public ProxyImpl()
        Create proxy transport layer - which, after configuring using the configure(String, Map, ProxyHandler, Transport) API is ready for layering in qpid-proton-j transport layers, using TransportInternal.addTransportLayer(TransportLayer) API.
      • ProxyImpl

        public ProxyImpl​(ProxyConfiguration configuration)
        Create proxy transport layer - which, after configuring using the configure(String, Map, ProxyHandler, Transport) API is ready for layering in qpid-proton-j transport layers, using TransportInternal.addTransportLayer(TransportLayer) API.
        Parameters:
        configuration - Proxy configuration to use.
    • Method Detail

      • wrap

        public org.apache.qpid.proton.engine.impl.TransportWrapper wrap​(org.apache.qpid.proton.engine.impl.TransportInput input,
                                                                        org.apache.qpid.proton.engine.impl.TransportOutput output)
        Adds the proxy in the transport layer chain.
        Specified by:
        wrap in interface org.apache.qpid.proton.engine.impl.TransportLayer
        Parameters:
        input - The input to the transport layer.
        output - The output from the transport layer.
        Returns:
        A transport layer containing the proxy.
      • configure

        public void configure​(String host,
                              Map<String,​String> headers,
                              ProxyHandler proxyHandler,
                              org.apache.qpid.proton.engine.Transport underlyingTransport)
        Configures the AMQP broker host with the given proxy handler and transport.
        Specified by:
        configure in interface Proxy
        Parameters:
        host - AMQP broker.
        headers - Additional headers to add to the proxy request.
        proxyHandler - Handler for the proxy.
        underlyingTransport - Actual transport layer.
      • getProxyRequestHeaders

        public Map<String,​String> getProxyRequestHeaders()
        Gets headers for the proxy request.
        Returns:
        Headers for the proxy request.
      • transferState

        public void transferState​(ProxyImpl fromProxy)
        transfers the state from the given proxy fromProxy to this proxy.
        Parameters:
        fromProxy - Proxy to transfer state from.
      • getInputBuffer

        protected ByteBuffer getInputBuffer()
        Buffer to read responses from.
        Returns:
        Buffer to read responses from.
      • getOutputBuffer

        protected ByteBuffer getOutputBuffer()
        Buffer to write responses and requests to.
        Returns:
        Buffer to write responses and requests to.
      • getIsProxyConfigured

        protected boolean getIsProxyConfigured()
        Whether settings to connect to a proxy are configured.
        Returns:
        true if settings are configured, false otherwise.
      • getProxyHandler

        protected ProxyHandler getProxyHandler()
        Gets the handler to respond to challenges from the proxy.
        Returns:
        the handler to respond to challenges from the proxy.
      • getUnderlyingTransport

        protected org.apache.qpid.proton.engine.Transport getUnderlyingTransport()
        Gets the next transport layer in the chain qpid-proton-j uses.
        Returns:
        The next transport layer in the chain qpid-proton-j uses.
      • writeProxyRequest

        protected void writeProxyRequest()
        Writes the CONNECT request.
      • getIsHandshakeInProgress

        protected boolean getIsHandshakeInProgress()
        Whether handshake is in progress.
        Returns:
        True if handshake is in progress.
      • getProxyState

        protected Proxy.ProxyState getProxyState()
        Gets the current state of the proxy.
        Returns:
        State of the proxy.