public override void Start() { Bootstrap(); using (var db = DAFactory.Get) { db.Hosts.CreateHost(CreateHost()); } Acceptor = new AsyncSocketAcceptor(); try { if (Config.Certificate != null) { var ssl = new SslFilter(new System.Security.Cryptography.X509Certificates.X509Certificate2(Config.Certificate)) { SslProtocol = SslProtocols.Tls }; Acceptor.FilterChain.AddLast("ssl", ssl); if (Debugger != null) { Acceptor.FilterChain.AddLast("packetLogger", new AriesProtocolLogger(Debugger.GetPacketLogger(), Kernel.Get <ISerializationContext>())); Debugger.AddSocketServer(this); } Acceptor.FilterChain.AddLast("protocol", new ProtocolCodecFilter(Kernel.Get <AriesProtocol>())); Acceptor.Handler = this; Acceptor.Bind(IPEndPointUtils.CreateIPEndPoint(Config.Binding)); LOG.Info("Listening on " + Acceptor.LocalEndPoint + " with TLS"); } //Bind in the plain too as a workaround until we can get Mina.NET to work nice for TLS in the AriesClient PlainAcceptor = new AsyncSocketAcceptor(); if (Debugger != null) { PlainAcceptor.FilterChain.AddLast("packetLogger", new AriesProtocolLogger(Debugger.GetPacketLogger(), Kernel.Get <ISerializationContext>())); } PlainAcceptor.FilterChain.AddLast("protocol", new ProtocolCodecFilter(Kernel.Get <AriesProtocol>())); PlainAcceptor.Handler = this; PlainAcceptor.Bind(IPEndPointUtils.CreateIPEndPoint(Config.Binding.Replace("100", "101"))); LOG.Info("Listening on " + PlainAcceptor.LocalEndPoint + " in the plain"); } catch (Exception ex) { LOG.Error("Unknown error bootstrapping server: " + ex.ToString(), ex); } }
public void Connect(string address) { Connect(IPEndPointUtils.CreateIPEndPoint(address)); }