public void secureconnection() { ResetAuthFlags(); clientBus.ClearKeyStore(); SrpKeyx_service_authlistener serviceAuthlistener = new SrpKeyx_service_authlistener(this); Assert.Equal(AllJoyn.QStatus.OK, serviceBus.EnablePeerSecurity("ALLJOYN_SRP_KEYX", serviceAuthlistener, null, false)); serviceBus.ClearKeyStore(); Assert.Equal(AllJoyn.QStatus.OK, SetUpAuthService()); SrpKeyx_client_authlistener clientAuthlistener = new SrpKeyx_client_authlistener(this); Assert.Equal(AllJoyn.QStatus.OK, clientBus.EnablePeerSecurity("ALLJOYN_SRP_KEYX", clientAuthlistener, null, false)); clientBus.ClearKeyStore(); AllJoyn.ProxyBusObject proxyBusObject = new AllJoyn.ProxyBusObject(clientBus, WELLKNOWN_NAME, OBJECT_PATH, 0); Assert.NotNull(proxyBusObject); proxyBusObject.SecureConnection(); Assert.True(authflags.requestCreds_service); Assert.True(authflags.authComplete_serivce); Assert.True(authflags.requestCreds_client); Assert.True(authflags.authComplete_client); ResetAuthFlags(); /* * the peer-to-peer connection should have been authenticated with the last * call to alljoyn_proxybusobject_secureconnection this call should return * ER_OK with out calling any of the authlistener functions. */ proxyBusObject.SecureConnection(); Assert.False(authflags.requestCreds_service); Assert.False(authflags.authComplete_serivce); Assert.False(authflags.requestCreds_client); Assert.False(authflags.authComplete_client); ResetAuthFlags(); /* * Although the peer-to-peer connection has already been authenticated we * are forcing re-authentication so we expect the authlistener functions to * be called again. */ proxyBusObject.SecureConnection(true); Assert.True(authflags.requestCreds_service); Assert.True(authflags.authComplete_serivce); Assert.True(authflags.requestCreds_client); Assert.True(authflags.authComplete_client); clientAuthlistener.Dispose(); serviceAuthlistener.Dispose(); busObject.Dispose(); proxyBusObject.Dispose(); }