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);
}
Aggregations