try {
conn = new ApacheHttpConnection(uri);
final EXistResult firstResult = new EXistResult(context);
final HttpResponse response = request.send(firstResult, conn, null);
if(response.getStatus() == 401) {
conn.disconnect();
result = sendOnceWithAuth(uri, request, parser.getCredentials());
} else {
result = firstResult;
registerConnectionWithContext(conn);
}