Class ProxyImpl
- java.lang.Object
-
- com.microsoft.azure.proton.transport.proxy.impl.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.microsoft.azure.proton.transport.proxy.Proxy
Proxy.ProxyState
-
-
Constructor Summary
Constructors Constructor Description ProxyImpl()Create proxy transport layer - which, after configuring using theconfigure(String, Map, ProxyHandler, Transport)API is ready for layering in qpid-proton-j transport layers, usingTransportInternal.addTransportLayer(TransportLayer)API.ProxyImpl(ProxyConfiguration configuration)Create proxy transport layer - which, after configuring using theconfigure(String, Map, ProxyHandler, Transport)API is ready for layering in qpid-proton-j transport layers, usingTransportInternal.addTransportLayer(TransportLayer)API.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(String host, Map<String,String> headers, ProxyHandler proxyHandler, org.apache.qpid.proton.engine.Transport underlyingTransport)Configures the AMQP brokerhostwith the given proxy handler and transport.protected ByteBuffergetInputBuffer()Buffer to read responses from.protected booleangetIsHandshakeInProgress()Whether handshake is in progress.protected booleangetIsProxyConfigured()Whether settings to connect to a proxy are configured.protected ByteBuffergetOutputBuffer()Buffer to write responses and requests to.protected ProxyHandlergetProxyHandler()Gets the handler to respond to challenges from the proxy.Map<String,String>getProxyRequestHeaders()Gets headers for the proxy request.protected Proxy.ProxyStategetProxyState()Gets the current state of the proxy.protected org.apache.qpid.proton.engine.TransportgetUnderlyingTransport()Gets the next transport layer in the chain qpid-proton-j uses.voidtransferState(ProxyImpl fromProxy)transfers the state from the given proxyfromProxyto this proxy.org.apache.qpid.proton.engine.impl.TransportWrapperwrap(org.apache.qpid.proton.engine.impl.TransportInput input, org.apache.qpid.proton.engine.impl.TransportOutput output)Adds the proxy in the transport layer chain.protected voidwriteProxyRequest()Writes the CONNECT request.
-
-
-
Constructor Detail
-
ProxyImpl
public ProxyImpl()
Create proxy transport layer - which, after configuring using theconfigure(String, Map, ProxyHandler, Transport)API is ready for layering in qpid-proton-j transport layers, usingTransportInternal.addTransportLayer(TransportLayer)API.
-
ProxyImpl
public ProxyImpl(ProxyConfiguration configuration)
Create proxy transport layer - which, after configuring using theconfigure(String, Map, ProxyHandler, Transport)API is ready for layering in qpid-proton-j transport layers, usingTransportInternal.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:
wrapin interfaceorg.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 brokerhostwith the given proxy handler and transport.
-
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 proxyfromProxyto 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.
-
-