@Test(expected = Exception.class) public void noServersTestRandomLB() throws Exception { Janus janus = new Janus( VIP_TEST, new ConstServerList(VIP_TEST), new RandomLoadBalancer(), new ServerStatsFactory(ServerStats.class, new MetricRegistry()) ); DefaultRestHttpClient client = new DefaultRestHttpClient(janus, 0, DefaultRestHttpClient.UTF8_STRING_SER_DE, "text/plain"); String result = client.get("/", String.class).getBody().deserialize(); Assert.assertNotNull(result); }
public <T> HttpResponse<T> get(String path, final Class<T> responseType) throws NoServerAvailableException, RetriesExceededException { FunctionWrapper<T> wrapped = new FunctionWrapper<T>() { @Override public HttpResponse<T> execute(String url) throws Exception { return client.get(url, contentType, responseType).waitForComplete(MAX_WAIT_SECONDS, TimeUnit.SECONDS).get(); } }; return executeWithLoadBalancer(path, wrapped); }
DefaultRestHttpClient { public <T> HttpResponse<T> get(String path, final Class<T> responseType) throws NoServerAvailableException, RetriesExceededException { FunctionWrapper<T> wrapped = new FunctionWrapper<T>() { @Override public HttpResponse<T> execute(String url) throws Exception { return client.get(url, contentType, responseType).waitForComplete(MAX_WAIT_SECONDS, TimeUnit.SECONDS).get(); } }; return executeWithLoadBalancer(path, wrapped); } }
DefaultRestHttpClient { public <T> HttpResponse<T> get(String path, final Class<T> responseType) throws NoServerAvailableException, RetriesExceededException { FunctionWrapper<T> wrapped = new FunctionWrapper<T>() { @Override public HttpResponse<T> execute(String url) throws Exception { return client.get(url, contentType, responseType).waitForComplete(MAX_WAIT_SECONDS, TimeUnit.SECONDS).get(); } }; return executeWithLoadBalancer(path, wrapped); } DefaultRestHttpClient(Janus janus, int numRetries);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig, SSLContext sslContext); }
DefaultRestHttpClient { public <T> HttpResponse<T> get(String path, final Class<T> responseType) throws NoServerAvailableException, RetriesExceededException { FunctionWrapper<T> wrapped = new FunctionWrapper<T>() { @Override public HttpResponse<T> execute(String url) throws Exception { return client.get(url, contentType, responseType).waitForComplete(MAX_WAIT_SECONDS, TimeUnit.SECONDS).get(); } }; return executeWithLoadBalancer(path, wrapped); } DefaultRestHttpClient(Janus janus, int numRetries);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig, SSLContext sslContext); HttpResponse<T> get(String path, final Class<T> responseType); HttpResponse<T> get(String path, final Class<T> responseType, final Object... pathVariables); HttpResponse<T> post(String path, final Object requestBody, final Class<T> responseType); HttpResponse<T> post(String path, final Object requestBody, final Class<T> responseType, final Object... pathVariables); void put(String path, final Object requestBody); void put(String path, final Object requestBody, final Object... pathVariables); void delete(String path); void delete(String path, final Object... pathVariables); }
DefaultRestHttpClient { public <T> HttpResponse<T> get(String path, final Class<T> responseType) throws NoServerAvailableException, RetriesExceededException { FunctionWrapper<T> wrapped = new FunctionWrapper<T>() { @Override public HttpResponse<T> execute(String url) throws Exception { return client.get(url, contentType, responseType).waitForComplete(MAX_WAIT_SECONDS, TimeUnit.SECONDS).get(); } }; return executeWithLoadBalancer(path, wrapped); } DefaultRestHttpClient(Janus janus, int numRetries);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig);  DefaultRestHttpClient(Janus janus, int numRetries, RestClientSerDe serDe, String contentType, RequestConfig requestConfig, SSLContext sslContext); HttpResponse<T> get(String path, final Class<T> responseType); HttpResponse<T> get(String path, final Class<T> responseType, final Object... pathVariables); HttpResponse<T> post(String path, final Object requestBody, final Class<T> responseType); HttpResponse<T> post(String path, final Object requestBody, final Class<T> responseType, final Object... pathVariables); void put(String path, final Object requestBody); void put(String path, final Object requestBody, final Object... pathVariables); void delete(String path); void delete(String path, final Object... pathVariables); static final RestClientSerDe JACKSON_JSON_SER_DE; static final RestClientSerDe UTF8_STRING_SER_DE; }