public override void ChannelRead(ChannelHandlerContext ctx, object msg) { if (_protocol.isExpecting(CatchupClientProtocol.State.MessageType)) { sbyte byteValue = (( ByteBuf )msg).readByte(); ResponseMessageType responseMessageType = from(byteValue); switch (responseMessageType.innerEnumValue) { case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.STORE_ID: _protocol.expect(CatchupClientProtocol.State.StoreId); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.TX: _protocol.expect(CatchupClientProtocol.State.TxPullResponse); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.FILE: _protocol.expect(CatchupClientProtocol.State.FileHeader); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.STORE_COPY_FINISHED: _protocol.expect(CatchupClientProtocol.State.StoreCopyFinished); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.CORE_SNAPSHOT: _protocol.expect(CatchupClientProtocol.State.CoreSnapshot); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.TX_STREAM_FINISHED: _protocol.expect(CatchupClientProtocol.State.TxStreamFinished); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.PREPARE_STORE_COPY_RESPONSE: _protocol.expect(CatchupClientProtocol.State.PrepareStoreCopyResponse); break; case Org.Neo4j.causalclustering.catchup.ResponseMessageType.InnerEnum.INDEX_SNAPSHOT_RESPONSE: _protocol.expect(CatchupClientProtocol.State.IndexSnapshotResponse); break; default: _log.warn("No handler found for message type %s (%d)", responseMessageType.name(), byteValue); break; } ReferenceCountUtil.release(msg); } else { ctx.fireChannelRead(msg); } }
/* * Order should not change. New states should be added as higher values and old states should not be replaced. */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHaveExpectedValues() public virtual void ShouldHaveExpectedValues() { ResponseMessageType[] givenStates = ResponseMessageType.values(); ResponseMessageType[] exepctedStates = new ResponseMessageType[] { TX, STORE_ID, FILE, STORE_COPY_FINISHED, CORE_SNAPSHOT, TX_STREAM_FINISHED, PREPARE_STORE_COPY_RESPONSE, INDEX_SNAPSHOT_RESPONSE, UNKNOWN }; sbyte[] expectedValues = new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8, unchecked (( sbyte )200) }; assertEquals(exepctedStates.Length, givenStates.Length); assertEquals(givenStates.Length, expectedValues.Length); for (int i = 0; i < givenStates.Length; i++) { assertEquals(givenStates[i].messageType(), exepctedStates[i].messageType()); assertEquals(givenStates[i].messageType(), expectedValues[i]); } }