boolean expectServerException,
boolean expectRandom,
boolean singleProxy) throws Exception {
boolean randomized = false;
String prevEndpoint = null;
BookStore bookStore = null;
if (singleProxy) {
bookStore = getBookStore(inactiveReplica, feature);
}
for (int i = 0; i < 20; i++) {
if (!singleProxy) {
feature.getTargetSelector().close();
bookStore = getBookStore(inactiveReplica, feature);
}
verifyStrategy(bookStore, expectRandom
? RandomStrategy.class
: SequentialStrategy.class);
String bookId = expectServerException ? "9999" : "123";
Exception ex = null;
try {
Book book = bookStore.getBook(bookId);
assertNotNull("expected non-null response", book);
assertEquals("unexpected id", 123L, book.getId());
} catch (Exception error) {
if (!expectServerException) {
//String currEndpoint = getCurrentEndpointAddress(bookStore);