use of com.netflix.ribbon.transport.netty.http.LoadBalancingHttpClient in project ribbon by Netflix.
the class RxMovieProxyExampleTest method testTransportFactoryWithInjection.
@Test
public void testTransportFactoryWithInjection() {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
}
});
RibbonTransportFactory transportFactory = injector.getInstance(RibbonTransportFactory.class);
HttpClient<ByteBuf, ByteBuf> client = transportFactory.newHttpClient("myClient");
IClientConfig config = ((LoadBalancingHttpClient) client).getClientConfig();
assertEquals("MyConfig", config.getNameSpace());
}
Aggregations