private void TestPbClientFactory() { IPEndPoint addr = new IPEndPoint(0); System.Console.Error.WriteLine(addr.GetHostName() + addr.Port); Configuration conf = new Configuration(); MRClientProtocol instance = new TestRPCFactories.MRClientProtocolTestImpl(this); Server server = null; try { server = RpcServerFactoryPBImpl.Get().GetServer(typeof(MRClientProtocol), instance , addr, conf, null, 1); server.Start(); System.Console.Error.WriteLine(server.GetListenerAddress()); System.Console.Error.WriteLine(NetUtils.GetConnectAddress(server)); MRClientProtocol client = null; try { client = (MRClientProtocol)RpcClientFactoryPBImpl.Get().GetClient(typeof(MRClientProtocol ), 1, NetUtils.GetConnectAddress(server), conf); } catch (YarnRuntimeException e) { Sharpen.Runtime.PrintStackTrace(e); NUnit.Framework.Assert.Fail("Failed to crete client"); } } catch (YarnRuntimeException e) { Sharpen.Runtime.PrintStackTrace(e); NUnit.Framework.Assert.Fail("Failed to crete server"); } finally { server.Stop(); } }
private void TestPbServerFactory() { IPEndPoint addr = new IPEndPoint(0); Configuration conf = new Configuration(); MRClientProtocol instance = new TestRPCFactories.MRClientProtocolTestImpl(this); Server server = null; try { server = RpcServerFactoryPBImpl.Get().GetServer(typeof(MRClientProtocol), instance , addr, conf, null, 1); server.Start(); } catch (YarnRuntimeException e) { Sharpen.Runtime.PrintStackTrace(e); NUnit.Framework.Assert.Fail("Failed to crete server"); } finally { server.Stop(); } }