@Override public Vertx vertx(VertxOptions options) { if (options.isClustered()) { throw new IllegalArgumentException("Please use Vertx.clusteredVertx() to create a clustered Vert.x instance"); } return VertxImpl.vertx(options); }
@Test public void testHttpBindError() { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends ServerChannel> serverChannelFactory(boolean domainSocket) { return (ChannelFactory<ServerChannel>) () -> { throw cause; }; } }); vertx.createHttpServer() .requestHandler(req -> fail()) .listen(8080, "localhost", onFailure(err -> { testComplete(); })); await(); } }
@Test public void testNetBindError() { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends ServerChannel> serverChannelFactory(boolean domainSocket) { return (ChannelFactory<ServerChannel>) () -> { throw cause; }; } }); vertx.createNetServer() .connectHandler(so -> fail()) .listen(1234, "localhost", onFailure(err -> { testComplete(); })); await(); }
private void testConnectErrorNotifiesOnEventLoop(NetClientOptions options) { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends Channel> channelFactory(boolean domainSocket) { return (ChannelFactory<Channel>) () -> { throw cause; }; } }); vertx.createNetServer().connectHandler(so -> { fail(); }).listen(1234, "localhost", onSuccess(v -> { vertx.createNetClient(options).connect(1234, "localhost", onFailure(err -> { assertSame(err, cause); testComplete(); })); })); await(); }
@Override public Vertx vertx(VertxOptions options) { if (options.isClustered()) { throw new IllegalArgumentException("Please use Vertx.clusteredVertx() to create a clustered Vert.x instance"); } return VertxImpl.vertx(options); }
@Test public void testHttpBindError() { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends ServerChannel> serverChannelFactory(boolean domainSocket) { return (ChannelFactory<ServerChannel>) () -> { throw cause; }; } }); vertx.createHttpServer() .requestHandler(req -> fail()) .listen(8080, "localhost", onFailure(err -> { testComplete(); })); await(); } }
@Test public void testNetBindError() { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends ServerChannel> serverChannelFactory(boolean domainSocket) { return (ChannelFactory<ServerChannel>) () -> { throw cause; }; } }); vertx.createNetServer() .connectHandler(so -> fail()) .listen(1234, "localhost", onFailure(err -> { testComplete(); })); await(); }
private void testConnectErrorNotifiesOnEventLoop(NetClientOptions options) { RuntimeException cause = new RuntimeException(); vertx = VertxImpl.vertx(new VertxOptions(), new Transport() { @Override public ChannelFactory<? extends Channel> channelFactory(boolean domainSocket) { return (ChannelFactory<Channel>) () -> { throw cause; }; } }); vertx.createNetServer().connectHandler(so -> { fail(); }).listen(1234, "localhost", onSuccess(v -> { vertx.createNetClient(options).connect(1234, "localhost", onFailure(err -> { assertSame(err, cause); testComplete(); })); })); await(); }