use of com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection in project azure-iot-sdk-java by Azure.
the class AmqpsTransportTest method messageReceivedAddsTheMessageToTheListOfMessagesToBeProcessed.
// Tests_SRS_AMQPSTRANSPORT_15_034: [The message received is added to the list of messages to be processed.]
@Test
public void messageReceivedAddsTheMessageToTheListOfMessagesToBeProcessed() throws IOException {
new NonStrictExpectations() {
{
new AmqpsIotHubConnection(mockConfig, false);
result = mockConnection;
}
};
AmqpsTransport transport = new AmqpsTransport(mockConfig, false);
transport.open();
Queue<AmqpsMessage> receivedMessages = new LinkedBlockingQueue<>();
receivedMessages.add(mockAmqpsMessage);
receivedMessages.add(mockAmqpsMessage);
Deencapsulation.setField(transport, "receivedMessages", receivedMessages);
transport.messageReceived(mockAmqpsMessage);
Assert.assertTrue(receivedMessages.size() == 3);
}
use of com.microsoft.azure.sdk.iot.device.transport.amqps.AmqpsIotHubConnection in project azure-iot-sdk-java by Azure.
the class AmqpsIotHubConnectionTest method constructorSetsHostNameCorrectlyWhenWebSocketsAreEnabled.
@Test
public void constructorSetsHostNameCorrectlyWhenWebSocketsAreEnabled() throws IOException {
baseExpectations();
AmqpsIotHubConnection connection = new AmqpsIotHubConnection(mockConfig, true);
String actualHostName = Deencapsulation.getField(connection, "hostName");
assertEquals(hostName + ":" + amqpWebSocketPort, actualHostName);
}
Aggregations