public void ClientInitiatorHasNoKeysCore(bool deriveKeys, MessageProtectionOrder order) { AsymmetricSecurityBindingElement sbe = new AsymmetricSecurityBindingElement(); sbe.InitiatorTokenParameters = new UserNameSecurityTokenParameters(); sbe.RecipientTokenParameters = new X509SecurityTokenParameters(); sbe.SetKeyDerivation(deriveKeys); sbe.MessageProtectionOrder = order; TransportBindingElement tbe = new HandlerTransportBindingElement(delegate(Message input) { // funky, but .NET does not raise an error // until it writes the message to somewhere. // That is, it won't raise an error if this // HandlerTransportBindingElement does not // write the input message to somewhere. // It is an obvious bug. input.WriteMessage(XmlWriter.Create(TextWriter.Null)); throw new Exception(); }); CustomBinding binding = new CustomBinding(sbe, tbe); EndpointAddress address = new EndpointAddress( new Uri("stream:dummy"), new X509CertificateEndpointIdentity(cert2)); CalcProxy proxy = new CalcProxy(binding, address); proxy.ClientCredentials.UserName.UserName = "******"; proxy.Open(); // Until here the wrong parameters are not checked. proxy.Sum(1, 2); }
public HandlerTransportChannelListener(HandlerTransportBindingElement source, Uri uri) { this.source = source; this.uri = uri; }
public HandlerTransportChannelFactory(HandlerTransportBindingElement source) { this.source = source; }