use of io.vertx.core.spi.cluster.impl.DefaultNodeSelector in project vert.x by eclipse.
the class WriteHandlerLookupFailureTest method test.
@Test
public void test() {
Throwable cause = new Throwable();
VertxOptions options = new VertxOptions();
options.getEventBusOptions().setHost("localhost").setPort(0);
NodeSelector nodeSelector = new DefaultNodeSelector() {
@Override
public void selectForSend(Message<?> message, Promise<String> promise) {
promise.fail(cause);
}
@Override
public void selectForPublish(Message<?> message, Promise<Iterable<String>> promise) {
promise.fail("Not implemented");
}
};
new VertxBuilder(options).init().clusterNodeSelector(nodeSelector).clusteredVertx(onSuccess(node -> {
vertx = node;
MessageProducer<String> sender = vertx.eventBus().sender("foo");
sender.write("the_string", onFailure(err -> {
assertSame(cause, err);
testComplete();
}));
}));
await();
}
Aggregations