/** * 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; }
protected TrueFxMarketDataServiceRaw(Exchange exchange) { super(exchange); final ClientConfig config = getClientConfig(); config.setJacksonObjectMapperFactory(factory); trueFx = RestProxyFactory.createProxy( TrueFxPublic.class, exchange.getExchangeSpecification().getPlainTextUri(), config); }
/** * Constructor * * @param exchange */ public CampBXBaseService(Exchange exchange) { super(exchange); ClientConfig config = getClientConfig(); // campbx server raises "internal error" if connected via these protocol versions config.setSslSocketFactory(CertHelper.createRestrictedSSLSocketFactory("TLSv1", "TLSv1.1")); this.campBX = RestProxyFactory.createProxy( CampBX.class, exchange.getExchangeSpecification().getSslUri(), config); } }
config = new ClientConfig(); //default config JacksonObjectMapperFactory mapperFactory = config.getJacksonObjectMapperFactory(); if (mapperFactory == null) { mapperFactory = new DefaultJacksonObjectMapperFactory(); new JacksonResponseReader(mapper, this.config.isIgnoreHttpErrorCodes())); responseReaderResolver.addReader(MediaType.TEXT_PLAIN, new PlainTextResponseReader(this.config.isIgnoreHttpErrorCodes())); this.config.getHttpConnTimeout(), this.config.getHttpReadTimeout(), this.config.getProxyHost(), this.config.getProxyPort(), this.config.getSslSocketFactory(), this.config.getHostnameVerifier(), this.config.getOAuthConsumer());
@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); }
protected RestInvocation createInvocation(Method method, Object[] args) { return RestInvocation.create( requestWriterResolver, getMetadata(method), args, config.getDefaultParamsMap() ); } }
public static ClientConfig addBasicAuthCredentials(ClientConfig config, String user, String password) { return config.addDefaultParam(HeaderParam.class, "Authorization", digestForBasicAuth(user, password)); }
config = new ClientConfig(); //default config JacksonObjectMapperFactory mapperFactory = config.getJacksonObjectMapperFactory(); if (mapperFactory == null) { mapperFactory = new DefaultJacksonObjectMapperFactory(); new JacksonResponseReader(mapper, this.config.isIgnoreHttpErrorCodes())); responseReaderResolver.addReader(MediaType.TEXT_PLAIN, new PlainTextResponseReader(this.config.isIgnoreHttpErrorCodes())); this.config.getHttpConnTimeout(), this.config.getHttpReadTimeout(), this.config.getProxyHost(), this.config.getProxyPort(), this.config.getSslSocketFactory(), this.config.getHostnameVerifier(), this.config.getOAuthConsumer());
protected RestInvocation createInvocation(Method method, Object[] args) { return RestInvocation.create( requestWriterResolver, getMetadata(method), args, config.getDefaultParamsMap() ); } }
public static ClientConfig addBasicAuthCredentials(ClientConfig config, String user, String password) { return config.addDefaultParam(HeaderParam.class, "Authorization", digestForBasicAuth(user, password)); }
/** * 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; }
clientConfig.setJacksonObjectMapperFactory( new DefaultJacksonObjectMapperFactory() { @Override
/** * Constructor * * @param exchange */ public CampBXBaseService(Exchange exchange) { super(exchange); ClientConfig config = getClientConfig(); // campbx server raises "internal error" if connected via these protocol versions config.setSslSocketFactory(CertHelper.createRestrictedSSLSocketFactory("TLSv1", "TLSv1.1")); this.campBX = RestProxyFactory.createProxy( CampBX.class, exchange.getExchangeSpecification().getSslUri(), config); } }
rescuConfig.setJacksonObjectMapperFactory( new DefaultJacksonObjectMapperFactory() { @Override
rescuConfig.setJacksonObjectMapperFactory( new DefaultJacksonObjectMapperFactory() { @Override