예제 #1
0
        /// <summary>initalize this channel</summary>
        private void InitChannel()
        {
            Ch.Elca.Iiop.Marshalling.ArgumentsSerializerFactory argumentSerializerFactory =
                omg.org.CORBA.OrbServices.GetSingleton().ArgumentsSerializerFactory;
            CodecFactory codecFactory =
                omg.org.CORBA.OrbServices.GetSingleton().CodecFactory;
            omg.org.IOP.Codec codec = codecFactory.create_codec(
                    new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal,
                                             1, 2));
            m_transportFactory.Codec = codec;
            m_iiopUrlUtil =
                omg.org.CORBA.OrbServices.GetSingleton().IiopUrlUtil;

            if (!m_isBidir)
            {
                m_conManager = new GiopClientConnectionManager(m_transportFactory, m_requestTimeOut,
                                                               m_unusedClientConnectionTimeOut, m_maxNumberOfConnections,
                                                               m_allowMultiplex, m_maxNumberOfMultplexedRequests,
                                                               m_headerFlags);
            }
            else
            {
                m_conManager = new GiopBidirectionalConnectionManager(m_transportFactory, m_requestTimeOut,
                                                                      m_unusedClientConnectionTimeOut, m_maxNumberOfConnections,
                                                                      m_allowMultiplex, m_maxNumberOfMultplexedRequests,
                                                                      m_headerFlags);
            }
            IiopClientTransportSinkProvider transportProvider =
                new IiopClientTransportSinkProvider(m_conManager);
            if (m_providerChain != null)
            {
                // append transport provider to the chain
                IClientChannelSinkProvider prov = m_providerChain;
                while (prov.Next != null) { prov = prov.Next; }
                prov.Next = transportProvider; // append the transport provider at the end
            }
            else
            {
                // create the default provider chain
                IClientFormatterSinkProvider formatterProv = new IiopClientFormatterSinkProvider();
                formatterProv.Next = transportProvider;
                m_providerChain = formatterProv;
            }
            GiopMessageHandler messageHandler =
                new GiopMessageHandler(argumentSerializerFactory,
                                       m_headerFlags, m_interceptionOptions);
            ConfigureSinkProviderChain(m_conManager, messageHandler, m_iiopUrlUtil,
                                       m_retryConfig);
        }
예제 #2
0
        private void Setup(string idSuffix, int retryNumber)
        {
            IDictionary props = new Hashtable();
            props[IiopServerChannel.PORT_KEY] = TEST_PORT.ToString();
            props[IiopClientChannel.MAX_NUMBER_OF_RETRIES_KEY] = "1";
            props[IiopClientChannel.RETRY_DELAY_KEY] = "10";
            IClientChannelSinkProvider clientSinkProvider =
                new IiopClientFormatterSinkProvider();
            m_testerProvider = new RetryingClientTransportTesterProvider();
            m_testerProvider.ForceNumberOfErrorCount = retryNumber;
            clientSinkProvider.Next = m_testerProvider;
            IServerChannelSinkProvider serverSinkProvider =
                new IiopServerFormatterSinkProvider();
            m_channel = new IiopChannel(props,
                                        clientSinkProvider,
                                        serverSinkProvider);
            ChannelServices.RegisterChannel(m_channel, false);

            m_targetIor = new Ior(Repository.GetRepositoryID(typeof(ISimpleCallTestOnChannel)),
                                  new IorProfile[] {
                                      new InternetIiopProfile(new GiopVersion(1,2),
                                                            "localhost", (ushort)TEST_PORT,
                                                            IorUtil.GetKeyBytesForId(TEST_URI + idSuffix))
                                  });
            m_targetIiopLoc = "iiop://localhost:" + TEST_PORT + "/" + TEST_URI + idSuffix;
            m_mbr = new SimpleCallTestOnChannelImpl();
            RemotingServices.Marshal(m_mbr, TEST_URI + idSuffix);
        }