private void InitiateHandshake(Channel channel, HandshakeClient handshakeClient) { _debugLog.info("Initiating handshake local %s remote %s", channel.localAddress(), channel.remoteAddress()); SimpleNettyChannel channelWrapper = new SimpleNettyChannel(channel, _debugLog); CompletableFuture <ProtocolStack> handshake = handshakeClient.Initiate(channelWrapper, _applicationProtocolRepository, _modifierProtocolRepository); handshake.whenComplete((protocolStack, failure) => onHandshakeComplete(protocolStack, channel, failure)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { _server = new Server(); _server.start(_raftApplicationProtocolRepository, _compressionModifierProtocolRepository); _handshakeClient = new HandshakeClient(); _client = new Client(_handshakeClient); _client.connect(_server.port()); }
private void ScheduleTimeout(SocketChannel ch, HandshakeClient handshakeClient) { ch.eventLoop().schedule(() => { if (handshakeClient.FailIfNotDone("Timed out after " + _timeout)) { _debugLog.warn("Failed handshake after timeout"); } }, _timeout.toMillis(), TimeUnit.MILLISECONDS); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void initChannel(io.netty.channel.socket.SocketChannel channel) throws Exception protected internal override void InitChannel(SocketChannel channel) { HandshakeClient handshakeClient = new HandshakeClient(); InstallHandlers(channel, handshakeClient); _debugLog.info("Scheduling handshake (and timeout) local %s remote %s", channel.localAddress(), channel.remoteAddress()); ScheduleHandshake(channel, handshakeClient, _handshakeDelay.newTimeout()); ScheduleTimeout(channel, handshakeClient); }
internal Fixture(Parameters parameters) { ApplicationProtocolRepository serverApplicationProtocolRepository = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), parameters.ServerApplicationProtocol); ModifierProtocolRepository serverModifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), parameters.ServerModifierProtocols); ClientApplicationProtocolRepository = new ApplicationProtocolRepository(TestProtocols_TestApplicationProtocols.values(), parameters.ClientApplicationProtocol); ClientModifierProtocolRepository = new ModifierProtocolRepository(TestProtocols_TestModifierProtocols.values(), parameters.ClientModifierProtocols); HandshakeClient = new HandshakeClient(); HandshakeServer = new HandshakeServer(serverApplicationProtocolRepository, serverModifierProtocolRepository, new FakeServerChannel(HandshakeClient)); ClientChannel = new FakeClientChannel(HandshakeServer); this.Parameters = parameters; }
/// <summary> /// schedules the handshake initiation after the connection attempt /// </summary> private void ScheduleHandshake(SocketChannel ch, HandshakeClient handshakeClient, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout handshakeDelay) { ch.eventLoop().schedule(() => { if (ch.Active) { InitiateHandshake(ch, handshakeClient); } else if (ch.Open) { handshakeDelay.Increment(); ScheduleHandshake(ch, handshakeClient, handshakeDelay); } else { handshakeClient.FailIfNotDone("Channel closed"); } }, handshakeDelay.Millis, MILLISECONDS); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void installHandlers(io.netty.channel.Channel channel, HandshakeClient handshakeClient) throws Exception private void InstallHandlers(Channel channel, HandshakeClient handshakeClient) { _pipelineBuilderFactory.client(channel, _debugLog).addFraming().add("handshake_client_encoder", new ClientMessageEncoder()).add("handshake_client_decoder", new ClientMessageDecoder()).add("handshake_client", new NettyHandshakeClient(handshakeClient)).addGate(msg => !(msg is ServerMessage)).install(); }
internal ClientInitializer(HandshakeClient handshakeClient) { this.HandshakeClient = handshakeClient; }
internal Client(HandshakeClient handshakeClient) { EventLoopGroup = new NioEventLoopGroup(); Bootstrap = (new Bootstrap()).group(EventLoopGroup).channel(typeof(NioSocketChannel)).handler(new ClientInitializer(handshakeClient)); }
public NettyHandshakeClient(HandshakeClient handler) { this._handler = handler; }
internal FakeServerChannel(HandshakeClient handshakeClient) : base() { this.HandshakeClient = handshakeClient; }