Search in sources :

Example 1 with IotHubReactor

use of com.microsoft.azure.sdk.iot.device.transport.amqps.IotHubReactor in project azure-iot-sdk-java by Azure.

the class AmqpsIotHubConnectionTest method openTriggersProtonReactor.

// Tests_SRS_AMQPSIOTHUBCONNECTION_15_009: [The function shall trigger the Reactor (Proton) to begin running.]
@Test
public void openTriggersProtonReactor() throws IOException, InterruptedException {
    baseExpectations();
    new NonStrictExpectations() {

        {
            new IotHubReactor((Reactor) any);
            result = mockIotHubReactor;
            mockIotHubReactor.run();
            mockOpenLock.waitLock(anyLong);
        }
    };
    AmqpsIotHubConnection connection = new AmqpsIotHubConnection(mockConfig, false);
    Deencapsulation.setField(connection, "openLock", mockOpenLock);
    connection.open();
    new Verifications() {

        {
            new IotHubSasToken(mockConfig, anyLong);
            times = 1;
            new IotHubReactor((Reactor) any);
            times = 1;
            mockOpenLock.waitLock(anyLong);
            times = 1;
        }
    };
}
Also used : AmqpsIotHubConnection(com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection) IotHubSasToken(com.microsoft.azure.sdk.iot.device.auth.IotHubSasToken) IotHubReactor(com.microsoft.azure.sdk.iot.device.transport.amqps.IotHubReactor) Test(org.junit.Test)

Aggregations

IotHubSasToken (com.microsoft.azure.sdk.iot.device.auth.IotHubSasToken)1 AmqpsIotHubConnection (com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection)1 IotHubReactor (com.microsoft.azure.sdk.iot.device.transport.amqps.IotHubReactor)1 Test (org.junit.Test)1