本文整理汇总了Java中io.vertx.ext.consul.ConsulClientOptions类的典型用法代码示例。如果您正苦于以下问题:Java ConsulClientOptions类的具体用法?Java ConsulClientOptions怎么用?Java ConsulClientOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsulClientOptions类属于io.vertx.ext.consul包,在下文中一共展示了ConsulClientOptions类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import io.vertx.ext.consul.ConsulClientOptions; //导入依赖的package包/类
@Before
public void setUp(TestContext tc) throws Exception {
vertx = Vertx.vertx();
vertx.exceptionHandler(tc.exceptionHandler());
client = ConsulClient.create(vertx, new ConsulClientOptions().setPort(consulProcess.getHttpPort()));
}
示例2: timeout
import io.vertx.ext.consul.ConsulClientOptions; //导入依赖的package包/类
@Test
public void timeout(TestContext tc) {
SlowHttpServer slowConsul = new SlowHttpServer(vertx, 10000);
ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(slowConsul.port()).setTimeout(1000));
client.agentInfo(tc.asyncAssertFailure(t -> {
ctx.closeClient(client);
slowConsul.close();
tc.assertTrue(t.getMessage().contains("The timeout period of 1000ms"));
}));
}
示例3: closedConnection
import io.vertx.ext.consul.ConsulClientOptions; //导入依赖的package包/类
@Test
public void closedConnection(TestContext tc) {
BrokenHttpServer brokenConsul = new BrokenHttpServer(vertx);
ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(brokenConsul.port()));
client.agentInfo(tc.asyncAssertFailure(t -> {
ctx.closeClient(client);
brokenConsul.close();
tc.assertTrue(t.getMessage().contains("Connection was closed"));
}));
}
示例4: init
import io.vertx.ext.consul.ConsulClientOptions; //导入依赖的package包/类
@Override
public void init(Vertx vertx, JsonObject config) {
ConsulClientOptions opt = new ConsulClientOptions(config);
this.client = ConsulClient.create(vertx, opt);
}
示例5: ConsulConfigStore
import io.vertx.ext.consul.ConsulClientOptions; //导入依赖的package包/类
ConsulConfigStore(Vertx vertx, JsonObject configuration) {
client = ConsulClient.create(vertx, new ConsulClientOptions(configuration));
delimiter = configuration.getString("delimiter", "/");
prefix = prefix(configuration.getString("prefix"), delimiter);
}