use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpReceive in project azure-iot-sdk-java by Azure.
the class AmqpReceiveTest method receive_with_timout_zero_call_flow_ok.
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_005: [The function shall initialize the Proton reactor object]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_006: [The function shall start the Proton reactor object]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_008: [The function shall stop and free the Proton reactor object ]
@Test
public void receive_with_timout_zero_call_flow_ok() throws IOException, InterruptedException {
// Arrange
String hostName = "aaa";
String userName = "bbb";
String sasToken = "ccc";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
int timeoutMs = 0;
AmqpReceive amqpReceive = new AmqpReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
amqpReceive.open();
// Assert
new Expectations() {
{
reactor = proton.reactor(amqpReceive);
reactor.start();
reactor.stop();
reactor.process();
reactor.free();
}
};
// Act
amqpReceive.receive(timeoutMs);
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpReceive in project azure-iot-sdk-java by Azure.
the class AmqpReceiveTest method receiveWithTimout_non_zero_call_ok.
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_005: [The function shall initialize the Proton reactor object]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_006: [The function shall start the Proton reactor object]
// Tests_SRS_SERVICE_SDK_JAVA_AMQPRECEIVE_12_008: [The function shall stop and free the Proton reactor object ]
@Test
public void receiveWithTimout_non_zero_call_ok() throws IOException, InterruptedException {
// Arrange
String hostName = "aaa";
String userName = "bbb";
String sasToken = "ccc";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
int timeoutMs = 1;
AmqpReceive amqpReceive = new AmqpReceive(hostName, userName, sasToken, iotHubServiceClientProtocol);
amqpReceive.open();
// Assert
new Expectations() {
{
reactor = proton.reactor(amqpReceive);
reactor.start();
reactor.stop();
reactor.process();
reactor.free();
}
};
// Act
amqpReceive.receive(timeoutMs);
}
Aggregations