本文整理了Java中io.vertx.core.http.HttpConnection.pingHandler()
方法的一些代码示例,展示了HttpConnection.pingHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpConnection.pingHandler()
方法的具体详情如下:
包路径:io.vertx.core.http.HttpConnection
类名称:HttpConnection
方法名:pingHandler
[英]Set an handler notified when a PING frame is received from the remote endpoint.
This is not implemented for HTTP/1.x.
[中]设置从远程端点接收PING帧时通知的处理程序。
这不是为HTTP/1实现的。十、
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testSendPing() throws Exception {
waitFor(2);
Buffer expected = TestUtils.randomBuffer(8);
Context ctx = vertx.getOrCreateContext();
server.close();
server.connectionHandler(conn -> {
conn.pingHandler(data -> {
assertEquals(expected, data);
complete();
});
});
server.requestHandler(req -> {});
startServer(ctx);
HttpClientRequest req = client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
});
req.connectionHandler(conn -> {
conn.ping(expected, ar -> {
assertTrue(ar.succeeded());
Buffer buff = ar.result();
assertEquals(expected, buff);
complete();
});
});
req.end();
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testReceivePing() throws Exception {
Buffer expected = TestUtils.randomBuffer(8);
Context ctx = vertx.getOrCreateContext();
server.close();
server.connectionHandler(conn -> {
conn.ping(expected, ar -> {
});
});
server.requestHandler(req -> {});
startServer(ctx);
HttpClientRequest req = client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
});
req.connectionHandler(conn -> {
conn.pingHandler(data -> {
assertEquals(expected, data);
complete();
});
});
req.end();
await();
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Set an handler notified when a frame is received from the remote endpoint.
* <p/>
* This is not implemented for HTTP/1.x.
* @param handler the handler to be called when a is received
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.core.http.HttpConnection pingHandler(Handler<io.vertx.rxjava.core.buffer.Buffer> handler) {
delegate.pingHandler(new Handler<io.vertx.core.buffer.Buffer>() {
public void handle(io.vertx.core.buffer.Buffer event) {
handler.handle(io.vertx.rxjava.core.buffer.Buffer.newInstance(event));
}
});
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set an handler notified when a frame is received from the remote endpoint.
* <p/>
* This is not implemented for HTTP/1.x.
* @param handler the handler to be called when a is received
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.core.http.HttpConnection pingHandler(Handler<io.vertx.rxjava.core.buffer.Buffer> handler) {
delegate.pingHandler(new Handler<io.vertx.core.buffer.Buffer>() {
public void handle(io.vertx.core.buffer.Buffer event) {
handler.handle(io.vertx.rxjava.core.buffer.Buffer.newInstance(event));
}
});
return this;
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testSendPing() throws Exception {
waitFor(2);
Buffer expected = TestUtils.randomBuffer(8);
Context ctx = vertx.getOrCreateContext();
server.close();
server.connectionHandler(conn -> {
conn.pingHandler(data -> {
assertEquals(expected, data);
complete();
});
});
server.requestHandler(req -> {});
startServer(ctx);
HttpClientRequest req = client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
});
req.connectionHandler(conn -> {
conn.ping(expected, ar -> {
assertTrue(ar.succeeded());
Buffer buff = ar.result();
assertEquals(expected, buff);
complete();
});
});
req.end();
await();
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testReceivePing() throws Exception {
Buffer expected = TestUtils.randomBuffer(8);
Context ctx = vertx.getOrCreateContext();
server.close();
server.connectionHandler(conn -> {
conn.ping(expected, ar -> {
});
});
server.requestHandler(req -> {});
startServer(ctx);
HttpClientRequest req = client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
});
req.connectionHandler(conn -> {
conn.pingHandler(data -> {
assertEquals(expected, data);
complete();
});
});
req.end();
await();
}
内容来源于网络,如有侵权,请联系作者删除!