// Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_024: [The event handler shall set the SASL_PLAIN // authentication on the transport using the given user name and sas token.] @Test public void onConnectionBoundSetsProperAuthenticationUsingUserNameAndSasToken() { final String hostName = "test.host.name"; final String deviceId = "test-deviceId"; final String userName = "******"; final String sasToken = "test-token"; AmqpsIotHubConnectionBaseHandler handler = new AmqpsIotHubConnectionBaseHandler( hostName, userName, sasToken, deviceId, mockIotHubConnection); handler.onConnectionBound(mockEvent); new Verifications() { { mockSasl = mockTransport.sasl(); mockSasl.plain(userName, sasToken); } }; }
// Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_025: [The event handler shall set ANONYMOUS_PEER // authentication mode on the domain of the Transport.] @Test public void onConnectionBoundSetsAuthenticationModeOnDomain() { final String hostName = "test.host.name"; final String deviceId = "test-deviceId"; final String userName = "******"; final String sasToken = "test-token"; AmqpsIotHubConnectionBaseHandler handler = new AmqpsIotHubConnectionBaseHandler( hostName, userName, sasToken, deviceId, mockIotHubConnection); handler.onConnectionBound(mockEvent); new Verifications() { { mockSslDomain.setPeerAuthentication(SslDomain.VerifyMode.ANONYMOUS_PEER); mockTransport.ssl(mockSslDomain); } }; }
// Tests_SRS_AMQPSIOTHUBCONNECTIONBASEHANDLER_14_023: [The event handler shall get the Transport // (Proton) object from the event.] @Test public void onConnectionBoundGetsTransport() { final String hostName = "test.host.name"; final String deviceId = "test-deviceId"; final String userName = "******"; final String sasToken = "test-token"; AmqpsIotHubConnectionBaseHandler handler = new AmqpsIotHubConnectionBaseHandler( hostName, userName, sasToken, deviceId, mockIotHubConnection); handler.onConnectionBound(mockEvent); new Verifications() { { mockConnection = mockEvent.getConnection(); mockConnection.getTransport(); } }; }