public static IServiceA Connect(Object callbackObject)
        {
            string remoteAddress = GetAddress();
            DuplexChannelFactory <IServiceA> pipeFactory = null;
            NetNamedPipeBinding binding = ConnectionFactory.GetBinding();

            serverMutex.WaitOne();
            try
            {
                try
                {
                    Console.WriteLine("Connecting to ServiceA @ " + remoteAddress);
                    pipeFactory = new DuplexChannelFactory <IServiceA>(
                        callbackObject,
                        binding,
                        new EndpointAddress(remoteAddress));

                    ServiceAConnection = pipeFactory.CreateChannel();

                    ServiceAConnection.RegisterClient();
                }
                catch (EndpointNotFoundException)
                {
                    try
                    {
                        Console.WriteLine("Failed to connect to service. Lets try to start the executeable.");

                        if (ServerPath.Length == 0)
                        {
                            ServerPath = GetServerPath();
                        }

                        Process.Start(ServerPath);

                        Thread.Sleep(2000);

                        ServiceAConnection = pipeFactory.CreateChannel();

                        ServiceAConnection.RegisterClient();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("");
                }
            }
            catch { }
            finally
            {
                serverMutex.ReleaseMutex();
            }
            return(ServiceAConnection);
        }