/** * Get a ClientConfig object which contains exchange-specific timeout values * (<i>httpConnTimeout</i> and <i>httpReadTimeout</i>) if they were present in the * ExchangeSpecification of this instance. Subclasses are encouraged to use this config object * when creating a RestCU proxy. * * @return a rescu client config object */ public ClientConfig getClientConfig() { ClientConfig rescuConfig = new ClientConfig(); // create default rescu config // set per exchange connection- and read-timeout (if they have been set in the // ExchangeSpecification) int customHttpConnTimeout = exchange.getExchangeSpecification().getHttpConnTimeout(); if (customHttpConnTimeout > 0) { rescuConfig.setHttpConnTimeout(customHttpConnTimeout); } int customHttpReadTimeout = exchange.getExchangeSpecification().getHttpReadTimeout(); if (customHttpReadTimeout > 0) { rescuConfig.setHttpReadTimeout(customHttpReadTimeout); } if (exchange.getExchangeSpecification().getProxyHost() != null) { rescuConfig.setProxyHost(exchange.getExchangeSpecification().getProxyHost()); } if (exchange.getExchangeSpecification().getProxyPort() != null) { rescuConfig.setProxyPort(exchange.getExchangeSpecification().getProxyPort()); } return rescuConfig; }
@BeforeClass public static void setup() { setLoggerLevel("batm", "trace"); setLoggerLevel("si.mazi.rescu","trace"); ClientConfig config = new ClientConfig(); config.setHttpReadTimeout(readTimeout); try { SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(null, null, null); final CompatSSLSocketFactory socketFactory = new CompatSSLSocketFactory(sslcontext.getSocketFactory()); config.setSslSocketFactory(socketFactory); config.setIgnoreHttpErrorCodes(true); }catch(KeyManagementException kme) { log.error("", kme); } catch (NoSuchAlgorithmException nae) { log.error("", nae); } api = RestProxyFactory.createProxy(IBitgoAPI.class, "https://test.bitgo.com/api", config); }
/** * Get a ClientConfig object which contains exchange-specific timeout values * (<i>httpConnTimeout</i> and <i>httpReadTimeout</i>) if they were present in the * ExchangeSpecification of this instance. Subclasses are encouraged to use this config object * when creating a RestCU proxy. * * @return a rescu client config object */ public ClientConfig getClientConfig() { ClientConfig rescuConfig = new ClientConfig(); // create default rescu config // set per exchange connection- and read-timeout (if they have been set in the // ExchangeSpecification) int customHttpConnTimeout = exchange.getExchangeSpecification().getHttpConnTimeout(); if (customHttpConnTimeout > 0) { rescuConfig.setHttpConnTimeout(customHttpConnTimeout); } int customHttpReadTimeout = exchange.getExchangeSpecification().getHttpReadTimeout(); if (customHttpReadTimeout > 0) { rescuConfig.setHttpReadTimeout(customHttpReadTimeout); } if (exchange.getExchangeSpecification().getProxyHost() != null) { rescuConfig.setProxyHost(exchange.getExchangeSpecification().getProxyHost()); } if (exchange.getExchangeSpecification().getProxyPort() != null) { rescuConfig.setProxyPort(exchange.getExchangeSpecification().getProxyPort()); } return rescuConfig; }