Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogExceptionOutboundWithVoidPromise()
        public virtual void ShouldLogExceptionOutboundWithVoidPromise()
        {
            Exception ex = new Exception();

            NettyPipelineBuilder.Server(_channel.pipeline(), _log).add("write_handler", new ChannelOutboundHandlerAdapterAnonymousInnerClass2(this, ex))                 // whenchannel.writeAndFlush(new object(), _channel.voidPromise());
            .install();

            // then
            _logProvider.assertExactly(inLog(this.GetType()).error(startsWith("Exception in outbound"), equalTo(ex)));
            assertFalse(_channel.Open);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogExceptionInbound()
        public virtual void ShouldLogExceptionInbound()
        {
            // given
            Exception ex = new Exception();

            NettyPipelineBuilder.Server(_channel.pipeline(), _log).add("read_handler", new ChannelInboundHandlerAdapterAnonymousInnerClass(this, ex))                 // whenchannel.writeOneInbound(new object());
            .install();

            // then
            _logProvider.assertExactly(inLog(this.GetType()).error(startsWith("Exception in inbound"), equalTo(ex)));
            assertFalse(_channel.Open);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeCloseHandlerOnPeerDisconnect() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeCloseHandlerOnPeerDisconnect()
        {
            Semaphore semaphore = new Semaphore(0);

            NettyPipelineBuilder.Server(_channel.pipeline(), _log).onClose(semaphore.release).install();

            // when
            _channel.disconnect();

            // then
            assertTrue(semaphore.tryAcquire(1, TimeUnit.MINUTES));
            assertFalse(_channel.Open);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLogAnythingForHandledOutbound()
        public virtual void ShouldNotLogAnythingForHandledOutbound()
        {
            // given
            object msg = new object();
            ChannelOutboundHandlerAdapter encoder = new ChannelOutboundHandlerAdapterAnonymousInnerClass3(this, msg);

            NettyPipelineBuilder.Server(_channel.pipeline(), _log).add("write_handler", encoder).install();

            // when
            _channel.writeAndFlush(msg);

            // then
            _logProvider.assertNoLoggingOccurred();
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogUnhandledMessageOutbound()
        public virtual void ShouldLogUnhandledMessageOutbound()
        {
            // given
            object msg = new object();

            NettyPipelineBuilder.Server(_channel.pipeline(), _log).install();

            // when
            _channel.writeAndFlush(msg);

            // then
            _logProvider.assertExactly(inLog(this.GetType()).error(equalTo("Unhandled outbound message: %s for channel: %s"), equalTo(msg), any(typeof(Channel))));
            assertFalse(_channel.Open);
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReInstallWithPreviousGate()
        public virtual void ShouldReInstallWithPreviousGate()
        {
            // given
            object gatedMessage = new object();

            ServerNettyPipelineBuilder builderA = NettyPipelineBuilder.Server(_channel.pipeline(), _log);

            builderA.AddGate(p => p == gatedMessage);
            builderA.Install();

            assertEquals(3, GetHandlers(_channel.pipeline()).Count);                   // head/tail error handlers also counted
            assertThat(_channel.pipeline().names(), hasItems(NettyPipelineBuilder.ERROR_HANDLER_HEAD, NettyPipelineBuilder.MESSAGE_GATE_NAME, NettyPipelineBuilder.ERROR_HANDLER_TAIL));

            // when
            ServerNettyPipelineBuilder builderB = NettyPipelineBuilder.Server(_channel.pipeline(), _log);

            builderB.Add("my_handler", EMPTY_HANDLER);
            builderB.Install();

            // then
            assertEquals(4, GetHandlers(_channel.pipeline()).Count);                   // head/tail error handlers also counted
            assertThat(_channel.pipeline().names(), hasItems(NettyPipelineBuilder.ERROR_HANDLER_HEAD, "my_handler", NettyPipelineBuilder.MESSAGE_GATE_NAME, NettyPipelineBuilder.ERROR_HANDLER_TAIL));
        }
Ejemplo n.º 7
0
 public override void Apply <BUILDER>(NettyPipelineBuilder <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server, BUILDER> nettyPipelineBuilder) where BUILDER : NettyPipelineBuilder <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server, BUILDER>
 {
     nettyPipelineBuilder.Add(PipelineDecoderName, Decoder.get());
 }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ServerNettyPipelineBuilder server(io.netty.channel.Channel channel, org.neo4j.logging.Log log) throws Exception
        public virtual ServerNettyPipelineBuilder Server(Channel channel, Log log)
        {
            return(Create(channel, NettyPipelineBuilder.Server(channel.pipeline(), log)));
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ClientNettyPipelineBuilder client(io.netty.channel.Channel channel, org.neo4j.logging.Log log) throws Exception
        public virtual ClientNettyPipelineBuilder Client(Channel channel, Log log)
        {
            return(Create(channel, NettyPipelineBuilder.Client(channel.pipeline(), log)));
        }
Ejemplo n.º 10
0
 public ChannelOutboundHandlerAdapterAnonymousInnerClass(NettyPipelineBuilder <O, BUILDER> outerInstance)
 {
     this.outerInstance = outerInstance;
 }