protected static (TcpRpcServer, TcpRpcClient) SetupClientServerPair(TcpRpcTestOptions options = TcpRpcTestOptions.None) { (var addr, int port) = TcpManager.Instance.GetLocalAddressAndPort(); var server = SetupServer(addr, port); var client = SetupClient(addr, port, options); return(server, client); }
protected static TcpRpcClient SetupClient(IPAddress addr, int port, TcpRpcTestOptions options = TcpRpcTestOptions.None) { var client = new TcpRpcClient(); client.AddBuffering(); if (options.HasFlag(TcpRpcTestOptions.ClientTracer)) { client.AttachTracer(new FrameTracing.RpcFrameTracer(Console.Out, false)); } if (options.HasFlag(TcpRpcTestOptions.ClientFluctStream)) { client.InjectMidlayer(s => new FluctStream(s)); } if (!options.HasFlag(TcpRpcTestOptions.ClientNoConnect)) { client.Connect(addr.ToString(), port); } return(client); }
protected static LocalhostTcpTestbed NewLocalhostTcpTestbed(TcpRpcTestOptions options = TcpRpcTestOptions.None) => new LocalhostTcpTestbed(options);
public LocalhostTcpTestbed(TcpRpcTestOptions options) { _options = options; }