protected IRingMasterRequestHandler ConnectToRingMaster() { SimpleTransport clientTransport = null; IRingMasterRequestHandler ringMaster = null; bool mustDispose = true; try { var configuration = new RingMasterClient.Configuration(); IRingMasterClientInstrumentation instrumentation = new RingMasterClientInstrumentation(); clientTransport = new SimpleTransport(); ringMaster = new RingMasterClient(configuration, instrumentation, this.protocol, clientTransport, CancellationToken.None); clientTransport.Connect(this.serverTransport); mustDispose = false; return(ringMaster); } finally { if (mustDispose) { ringMaster.Dispose(); clientTransport.Dispose(); } } }