Search in sources :

Example 6 with WebSocketImpl

use of com.microsoft.azure.proton.transport.ws.impl.WebSocketImpl in project azure-iot-sdk-java by Azure.

the class AmqpsConnection method onConnectionBound.

@Override
public void onConnectionBound(Event event) {
    Transport transport = event.getConnection().getTransport();
    if (transport != null) {
        if (this.saslListener != null) {
            log.debug("Setting up sasl negotiator");
            // Calling sasl here adds a transport layer for handling sasl negotiation
            transport.sasl().setListener(this.saslListener);
        }
        if (this.useWebSockets) {
            log.debug("Adding websocket layer");
            WebSocketImpl webSocket = new WebSocketImpl(MAX_MESSAGE_PAYLOAD_SIZE);
            webSocket.configure(this.hostName, WEB_SOCKET_PATH, WEB_SOCKET_QUERY, AMQP_WEB_SOCKET_PORT, WEB_SOCKET_SUB_PROTOCOL, null, null);
            ((TransportInternal) transport).addTransportLayer(webSocket);
        }
        SslDomain domain = makeDomain();
        transport.ssl(domain);
    }
}
Also used : WebSocketImpl(com.microsoft.azure.proton.transport.ws.impl.WebSocketImpl) TransportInternal(org.apache.qpid.proton.engine.impl.TransportInternal)

Aggregations

WebSocketImpl (com.microsoft.azure.proton.transport.ws.impl.WebSocketImpl)6 IotHubServiceClientProtocol (com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol)3 Expectations (mockit.Expectations)3 TransportInternal (org.apache.qpid.proton.engine.impl.TransportInternal)3 Test (org.junit.Test)3 ProxyHandlerImpl (com.microsoft.azure.proton.transport.proxy.impl.ProxyHandlerImpl)1 ProxyImpl (com.microsoft.azure.proton.transport.proxy.impl.ProxyImpl)1 IotHubSSLContext (com.microsoft.azure.sdk.iot.deps.auth.IotHubSSLContext)1 AmqpFeedbackReceivedHandler (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpFeedbackReceivedHandler)1 AmqpSendHandler (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSendHandler)1 SslDomain (org.apache.qpid.proton.engine.SslDomain)1 Transport (org.apache.qpid.proton.engine.Transport)1