IAsyncResult IAsyncRelayTransport.BeginSendMessage(SerializedRelayMessage message, AsyncCallback callback, object state)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            if (message.IsTwoWayMessage)
            {
                throw new ApplicationException("Cannot send pre-serialized out message.");
            }

            var result = new SimpleAsyncResult(callback, state);

            asyncSocketClient.SendOneWayAsync <MemoryStream>(
                (short)SocketCommand.HandleOneWayMessage,
                message.MessageStream,
                (messageStream, stream) => stream.Write(
                    messageStream.GetBuffer(),
                    (int)messageStream.Position,
                    (int)messageStream.Length),
                args =>
            {
                result.Error = args.Error;
                result.CompleteOperation(args.CompletedSynchronously);
            });
            return(result);
        }