/** * Like {@link #goAway(long, int, Buffer)} with no buffer. */ @Fluent default HttpConnection goAway(long errorCode, int lastStreamId) { return goAway(errorCode, lastStreamId, null); }
switch (reqCount.getAndIncrement()) { case 0: req.connection().goAway(0); break; case 1:
/** * Like {@link #goAway(long, int)} with a last stream id {@code -1} which means to disallow any new stream creation. */ @Fluent default HttpConnection goAway(long errorCode) { return goAway(errorCode, -1); }
switch (reqCount.getAndIncrement()) { case 0: req.connection().goAway(0); break; case 1:
@Test public void testSendingGoAwayDiscardsTheConnection() throws Exception { AtomicInteger reqCount = new AtomicInteger(); server.requestHandler(req -> { switch (reqCount.getAndIncrement()) { case 0: req.response().setChunked(true).write("some-data"); break; case 1: req.response().end(); break; default: fail(); } }); startServer(); client.getNow(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", onSuccess(resp -> { resp.request().connection().goAway(0); client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp2 -> { testComplete(); }).setTimeout(5000).exceptionHandler(this::fail).end(); })); await(); }
/** * Like {@link #goAway(long, int, Buffer)} with no buffer. */ @Fluent default HttpConnection goAway(long errorCode, int lastStreamId) { return goAway(errorCode, lastStreamId, null); }
/** * Like {@link #goAway(long, int)} with a last stream id {@code -1} which means to disallow any new stream creation. */ @Fluent default HttpConnection goAway(long errorCode) { return goAway(errorCode, -1); }
/** * Like {@link io.vertx.rxjava.core.http.HttpConnection#goAway} with no buffer. * @param errorCode * @param lastStreamId * @return */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode, int lastStreamId) { delegate.goAway(errorCode, lastStreamId); return this; }
/** * Like {@link io.vertx.rxjava.core.http.HttpConnection#goAway} with a last stream id <code>-1</code> which means to disallow any new stream creation. * @param errorCode * @return */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode) { delegate.goAway(errorCode); return this; }
/** * Like {@link io.vertx.rxjava.core.http.HttpConnection#goAway} with a last stream id <code>-1</code> which means to disallow any new stream creation. * @param errorCode * @return */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode) { delegate.goAway(errorCode); return this; }
/** * Like {@link io.vertx.rxjava.core.http.HttpConnection#goAway} with no buffer. * @param errorCode * @param lastStreamId * @return */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode, int lastStreamId) { delegate.goAway(errorCode, lastStreamId); return this; }
@Test public void testSendingGoAwayDiscardsTheConnection() throws Exception { AtomicInteger reqCount = new AtomicInteger(); server.requestHandler(req -> { switch (reqCount.getAndIncrement()) { case 0: req.response().setChunked(true).write("some-data"); break; case 1: req.response().end(); break; default: fail(); } }); startServer(); HttpClientRequest req1 = client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath"); req1.handler(resp1 -> { req1.connection().goAway(0); client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp2 -> { testComplete(); }).setTimeout(5000).exceptionHandler(this::fail).end(); }).end(); await(); }
/** * Send a go away frame to the remote endpoint of the connection. * <p/> * <ul> * <li>a frame is sent to the to the remote endpoint with the <code>errorCode</code> and <code>debugData</code></li> * <li>any stream created after the stream identified by <code>lastStreamId</code> will be closed</li> * <li>for an is different than <code>0</code> when all the remaining streams are closed this connection will be closed automatically</li> * </ul> * <p/> * This is not implemented for HTTP/1.x. * @param errorCode the error code * @param lastStreamId the last stream id * @param debugData additional debug data sent to the remote endpoint * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode, int lastStreamId, io.vertx.rxjava.core.buffer.Buffer debugData) { delegate.goAway(errorCode, lastStreamId, debugData.getDelegate()); return this; }
/** * Send a go away frame to the remote endpoint of the connection. * <p/> * <ul> * <li>a frame is sent to the to the remote endpoint with the <code>errorCode</code> and <code>debugData</code></li> * <li>any stream created after the stream identified by <code>lastStreamId</code> will be closed</li> * <li>for an is different than <code>0</code> when all the remaining streams are closed this connection will be closed automatically</li> * </ul> * <p/> * This is not implemented for HTTP/1.x. * @param errorCode the error code * @param lastStreamId the last stream id * @param debugData additional debug data sent to the remote endpoint * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.HttpConnection goAway(long errorCode, int lastStreamId, io.vertx.rxjava.core.buffer.Buffer debugData) { delegate.goAway(errorCode, lastStreamId, debugData.getDelegate()); return this; }