Search in sources :

Example 1 with ProxyConfiguration

use of com.microsoft.azure.proton.transport.proxy.ProxyConfiguration in project azure-iot-sdk-java by Azure.

the class AmqpsIotHubConnection method addProxyLayer.

private void addProxyLayer(Transport transport, String hostName) {
    log.debug("Adding proxy layer to amqp transport");
    ProxyImpl proxy;
    if (proxySettings.getUsername() != null && proxySettings.getPassword() != null) {
        log.trace("Adding proxy username and password to amqp proxy configuration");
        ProxyConfiguration proxyConfiguration = new ProxyConfiguration(ProxyAuthenticationType.BASIC, proxySettings.getProxy(), proxySettings.getUsername(), new String(proxySettings.getPassword()));
        proxy = new ProxyImpl(proxyConfiguration);
    } else {
        log.trace("No proxy username and password will be used amqp proxy configuration");
        proxy = new ProxyImpl();
    }
    final ProxyHandler proxyHandler = new ProxyHandlerImpl();
    proxy.configure(hostName, null, proxyHandler, transport);
    ((TransportInternal) transport).addTransportLayer(proxy);
}
Also used : ProxyHandlerImpl(com.microsoft.azure.proton.transport.proxy.impl.ProxyHandlerImpl) ProxyImpl(com.microsoft.azure.proton.transport.proxy.impl.ProxyImpl) ProxyConfiguration(com.microsoft.azure.proton.transport.proxy.ProxyConfiguration) ProxyHandler(com.microsoft.azure.proton.transport.proxy.ProxyHandler) TransportInternal(org.apache.qpid.proton.engine.impl.TransportInternal)

Aggregations

ProxyConfiguration (com.microsoft.azure.proton.transport.proxy.ProxyConfiguration)1 ProxyHandler (com.microsoft.azure.proton.transport.proxy.ProxyHandler)1 ProxyHandlerImpl (com.microsoft.azure.proton.transport.proxy.impl.ProxyHandlerImpl)1 ProxyImpl (com.microsoft.azure.proton.transport.proxy.impl.ProxyImpl)1 TransportInternal (org.apache.qpid.proton.engine.impl.TransportInternal)1