private void OnReceived(SocketEvent socketEvent)
 {
     this.scheduler.Schedule(() =>
     {
         if (socketEvent.BytesTransferred > 0)
         {
             var incommingData = new byte[socketEvent.BytesTransferred];
             for (var i = 0; i < socketEvent.BytesTransferred; i++)
             {
                 incommingData[i] = socketEvent.Segment[i];
             }
             PublishEvent(new DataReceivedEvent((AbstractClient)socketEvent.UserToken, incommingData, socketEvent.BytesTransferred));
             StartReceive(socketEvent);
         }
         else
         {
             Disconnect(socketEvent);
         }
     });
 }
 private void OnDisconnected(SocketEvent socketEvent)
 {
     Disconnect(socketEvent);
 }