Index: trunk/sources/HeuristicLab.Hive.Client.Communication/HeuristicLab.Hive.Client.Communication.csproj
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Communication/HeuristicLab.Hive.Client.Communication.csproj	(revision 921)
+++ trunk/sources/HeuristicLab.Hive.Client.Communication/HeuristicLab.Hive.Client.Communication.csproj	(revision 923)
@@ -71,4 +71,5 @@
     <Compile Include="ServerProxy.cs" />
     <Compile Include="ServiceLocator.cs" />
+    <Compile Include="WcfService.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -80,4 +81,8 @@
       <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
       <Name>HeuristicLab.Core</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Hive.Client.Common\HeuristicLab.Hive.Client.Common.csproj">
+      <Project>{89F4BC52-C174-481E-9BD2-3814171020E8}</Project>
+      <Name>HeuristicLab.Hive.Client.Common</Name>
     </ProjectReference>
     <ProjectReference Include="..\HeuristicLab.Hive.Contracts\HeuristicLab.Hive.Contracts.csproj">
Index: trunk/sources/HeuristicLab.Hive.Client.Communication/WcfService.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Communication/WcfService.cs	(revision 923)
+++ trunk/sources/HeuristicLab.Hive.Client.Communication/WcfService.cs	(revision 923)
@@ -0,0 +1,125 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ServiceModel;
+using HeuristicLab.Hive.Contracts.Interfaces;
+using HeuristicLab.Hive.Contracts;
+using HeuristicLab.Hive.Contracts.BusinessObjects;
+using HeuristicLab.Hive.Client.Common;
+
+
+namespace HeuristicLab.Hive.Client.Communication {
+  public class WcfService {
+    private static WcfService instance;
+    public static WcfService Instance {
+      get {
+        if (instance == null) {
+          instance = new WcfService();
+        }
+        return instance;
+      }
+    }
+
+    public enum ConnectionState { connected, disconnected, failed };
+
+    private ClientCommunicatorClient proxy = null;
+
+    public ConnectionState ConnState { get; set; }
+
+    private string serverIP;
+    private string serverPort;
+
+    private WcfService() {
+    }
+    public void Connect() {
+      try {
+        if (proxy == null) {
+          proxy = new ClientCommunicatorClient(
+            new NetTcpBinding(),
+            new EndpointAddress("net.tcp://" + serverIP + ":" + serverPort + "/HiveServer/ClientCommunicator")
+            );
+        }
+
+        proxy.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(proxy_LoginCompleted);
+        proxy.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(proxy_PullJobCompleted);
+        proxy.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(proxy_SendJobResultCompleted);
+        proxy.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(proxy_SendHeartBeatCompleted);
+      }
+      catch (Exception ex) {
+        NetworkErrorHandling(ex);
+      }
+    }
+
+    public void Connect(String serverIP, String serverPort) {
+      this.serverIP = serverIP;
+      this.serverPort = serverPort;
+      Connect();
+    }
+
+    private void NetworkErrorHandling(Exception e) {
+      ConnState = ConnectionState.failed;
+      Logging.GetInstance().Error(this.ToString(), "exception: ", e);
+    }
+
+    #region Login
+    public event System.EventHandler<LoginCompletedEventArgs> LoginCompleted;
+    public void LoginAsync(ClientInfo clientInfo) {
+      if (ConnState == ConnectionState.connected)
+        proxy.LoginAsync(clientInfo);
+    }
+    private void proxy_LoginCompleted(object sender, LoginCompletedEventArgs e) {
+      if (e.Error == null)
+        LoginCompleted(sender, e);
+      else
+        NetworkErrorHandling(e.Error.InnerException);
+    }
+    #endregion
+
+    #region PullJob
+    public event System.EventHandler<PullJobCompletedEventArgs> PullJobCompleted;
+    public void PullJobAsync(Guid guid) {
+      if (ConnState == ConnectionState.connected)
+        proxy.PullJobAsync(guid);
+    }
+    void proxy_PullJobCompleted(object sender, PullJobCompletedEventArgs e) {
+      if (e.Error == null)
+        PullJobCompleted(sender, e);
+      else
+        NetworkErrorHandling(e.Error);
+    }
+    #endregion
+
+    #region SendJobResults
+    public event System.EventHandler<SendJobResultCompletedEventArgs> SendJobResultCompleted;
+    public void SendJobResultAsync(JobResult result, bool finished) {
+      if (ConnState == ConnectionState.connected)
+        proxy.SendJobResult(result, finished);
+    }
+    private void proxy_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) {
+      if (e.Error == null)
+        SendJobResultCompleted(sender, e);
+      else
+        NetworkErrorHandling(e.Error);
+    }
+
+    #endregion
+
+    #region Heartbeat
+
+    public event System.EventHandler<SendHeartBeatCompletedEventArgs> SendHeartBeatCompleted;
+    public void SendHeartBeatAsync(HeartBeatData hbd) {
+      if (ConnState == ConnectionState.connected)
+        proxy.SendHeartBeatAsync(hbd);
+    }
+
+    private void proxy_SendHeartBeatCompleted(object sender, SendHeartBeatCompletedEventArgs e) {
+      if (e.Error == null)
+        SendHeartBeatCompleted(sender, e);
+      else
+        NetworkErrorHandling(e.Error);
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 921)
+++ trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 923)
@@ -50,5 +50,5 @@
     Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>();
 
-    private ClientCommunicatorClient clientCommunicator;
+    private WcfService wcfService;
 
     public void Start() {
@@ -60,9 +60,12 @@
       manager.Core = this;
 
-      clientCommunicator = ServiceLocator.GetClientCommunicator();
-      clientCommunicator.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(ClientCommunicator_LoginCompleted);
-      clientCommunicator.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(ClientCommunicator_PullJobCompleted);
-      clientCommunicator.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(ClientCommunicator_SendJobResultCompleted);
-      //clientCommunicator.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo());
+      wcfService = WcfService.Instance;
+      wcfService.Connect("192.168.132.1", "9000");
+
+      wcfService.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(wcfService_LoginCompleted);
+      wcfService.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(wcfService_PullJobCompleted);
+      wcfService.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(wcfService_SendJobResultCompleted);
+
+      wcfService.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo());
 
       Heartbeat beat = new Heartbeat { Interval = 10000 };
@@ -76,14 +79,4 @@
         DetermineAction(container);
       }
-    }
-
-    void ClientCommunicator_LoginCompleted(object sender, LoginCompletedEventArgs e) {
-      if (e.Result.Success) {
-        Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);
-        ConfigurationManager.GetInstance().Loggedin();
-        Status.LoginTime = DateTime.Now;
-        Status.LoggedIn = true;
-      } else
-        Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage);
     }
 
@@ -106,5 +99,5 @@
 
         case MessageContainer.MessageType.FetchJob: 
-          clientCommunicator.PullJobAsync(Guid.NewGuid());
+          wcfService.PullJobAsync(Guid.NewGuid());
           break;          
         case MessageContainer.MessageType.FinishedJob:
@@ -115,4 +108,6 @@
     }
 
+    #region Async Threads for the EE
+    
     private void GetFinishedJob(object jobId) {
       long jId = (long)jobId;
@@ -120,5 +115,5 @@
       
       JobResult jobResult = new JobResult { JobId = jId, Result = sJob, Client = ConfigurationManager.GetInstance().GetClientInfo() };
-      clientCommunicator.SendJobResultAsync(jobResult, true);
+      wcfService.SendJobResultAsync(jobResult, true);
     }
 
@@ -128,5 +123,19 @@
     }
 
-    void ClientCommunicator_PullJobCompleted(object sender, PullJobCompletedEventArgs e) {
+    #endregion
+
+    #region wcfService Events
+
+    void wcfService_LoginCompleted(object sender, LoginCompletedEventArgs e) {
+      if (e.Result.Success) {
+        Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);
+        ConfigurationManager.GetInstance().Loggedin();
+        Status.LoginTime = DateTime.Now;
+        Status.LoggedIn = true;
+      } else
+        Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage);
+    }    
+
+    void wcfService_PullJobCompleted(object sender, PullJobCompletedEventArgs e) {
       bool sandboxed = false;
 
@@ -147,5 +156,5 @@
     }
 
-    void ClientCommunicator_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) {
+    void wcfService_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) {
       if (e.Result.Success) {
         AppDomain.Unload(appDomains[e.Result.JobId]);
@@ -159,4 +168,6 @@
     }
 
+    #endregion
+
     public Dictionary<long, Executor> GetExecutionEngines() {
       return engines;
Index: trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs	(revision 921)
+++ trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs	(revision 923)
@@ -48,5 +48,5 @@
     }
 
-    private ClientCommunicatorClient clientCommunicator;
+    private WcfService wcfService;
 
     /// <summary>
@@ -58,6 +58,6 @@
       heartbeatTimer.AutoReset = true;
       heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed);
-      clientCommunicator = ServiceLocator.GetClientCommunicator();
-      clientCommunicator.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(ClientCommunicator_SendHeartBeatCompleted);
+      wcfService = WcfService.Instance;
+      wcfService.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(wcfService_SendHeartBeatCompleted);
       heartbeatTimer.Start();
     }
@@ -74,8 +74,12 @@
                                                               freeMemory = 1000, 
                                                               jobProgress = 1};
-      clientCommunicator.SendHeartBeatAsync(heartBeatData);
+      if (wcfService.ConnState == WcfService.ConnectionState.failed) {
+        wcfService.Connect();
+      } else if (wcfService.ConnState == WcfService.ConnectionState.connected) {
+        wcfService.SendHeartBeatAsync(heartBeatData);
+      }
     }
 
-    void ClientCommunicator_SendHeartBeatCompleted(object sender, SendHeartBeatCompletedEventArgs e) {
+    void wcfService_SendHeartBeatCompleted(object sender, SendHeartBeatCompletedEventArgs e) {
       System.Diagnostics.Debug.WriteLine("Heartbeat received! ");
       e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc));
