private void SendDataCallback(IAsyncResult asyncResult)
{
AsyncSendDataResult asyncSendDataResult = (AsyncSendDataResult)asyncResult.AsyncState;
try {
_recordStream.EndSend(asyncResult);
asyncSendDataResult.SetComplete();
} catch (AlertException ae) {
ProcessSendFatalAlert(new Alert(ae.AlertDescription, _handshakeSession.NegotiatedVersion));
asyncSendDataResult.SetComplete(new Exception("Connection closed because of local alert", ae));
} catch (IOException) {
asyncSendDataResult.SetComplete(new EndOfStreamException("Connection closed unexpectedly"));
} catch (Exception e) {
ProcessSendFatalAlert(new Alert(AlertDescription.InternalError, _handshakeSession.NegotiatedVersion));
asyncSendDataResult.SetComplete(new Exception("Connection closed because of local error", e));
}
}