// Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_026: [The event handler shall get the Connection // (Proton) object from the event handler and set the host name on the connection.] // Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_027: [The event handler shall create a Session // (Proton) object from the connection.] // Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_028: [The event handler shall create a Receiver // and Sender (Proton) object and set the protocol tag on them to a predefined constant.] // Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_029: [The event handler shall open the // Connection, Session, and Receiver objects.] @Test public void onConnectionInitCreatesSession() { final String hostName = "test.host.name"; final String deviceId = "test-deviceId"; final String userName = "******"; final String sasToken = "test-token"; final String tag = "receiver"; AmqpsIotHubConnectionBaseHandler handler = new AmqpsIotHubConnectionBaseHandler( hostName, userName, sasToken, deviceId, mockIotHubConnection); handler.onConnectionInit(mockEvent); final String expectedHostName = String.format("%s:%d", hostName, PORT); new Verifications() { { mockEvent.getConnection(); mockConnection.setHostname(expectedHostName); mockConnection.session(); mockSession.receiver(tag); mockConnection.open(); mockSession.open(); mockReceiver.open(); } }; }