public void Disconnect()
{
try {
if (Connector != null) {
var response = SendMessage(new CloseRequest())
as AcknowledgeResponse;
if (response == null)
throw new InvalidOperationException();
if (!response.State)
throw new DeveelDbServerException("Unable to close the connection on the server.", -1, -1);
}
} finally {
if (Connector != null && OwnsConnector) {
Connector.Dispose();
Connector = null;
}
IsClosed = true;
}
}