當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultVertxFactory類代碼示例

本文整理匯總了Java中org.vertx.java.core.impl.DefaultVertxFactory的典型用法代碼示例。如果您正苦於以下問題:Java DefaultVertxFactory類的具體用法?Java DefaultVertxFactory怎麽用?Java DefaultVertxFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultVertxFactory類屬於org.vertx.java.core.impl包,在下文中一共展示了DefaultVertxFactory類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeApp

import org.vertx.java.core.impl.DefaultVertxFactory; //導入依賴的package包/類
@Override
public void executeApp() throws Exception {
    int port = getAvailablePort();
    HttpServer httpServer = new DefaultVertxFactory().createVertx().createHttpServer()
            .requestHandler(new Handler<HttpServerRequest>() {
                @Override
                public void handle(HttpServerRequest req) {
                    req.response.end("Hello World!");
                }
            }).listen(port);
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet httpGet = new HttpGet("http://localhost:" + port + "/abc?xyz=123");
    int statusCode = httpClient.execute(httpGet).getStatusLine().getStatusCode();
    if (statusCode != 200) {
        throw new IllegalStateException("Unexpected status code: " + statusCode);
    }
    httpServer.close();
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:19,代碼來源:Vertx1xIT.java

示例2: executeApp

import org.vertx.java.core.impl.DefaultVertxFactory; //導入依賴的package包/類
@Override
public void executeApp() throws Exception {
    int port = getAvailablePort();
    HttpServer httpServer = new DefaultVertxFactory().createVertx().createHttpServer()
            .requestHandler(new Handler<HttpServerRequest>() {
                @Override
                public void handle(HttpServerRequest req) {
                    req.response().end("Hello World!");
                }
            }).listen(port);
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet httpGet = new HttpGet("http://localhost:" + port + "/abc?xyz=123");
    int statusCode = httpClient.execute(httpGet).getStatusLine().getStatusCode();
    if (statusCode != 200) {
        throw new IllegalStateException("Unexpected status code: " + statusCode);
    }
    httpServer.close();
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:19,代碼來源:Vertx2xIT.java

示例3: TcpTransport

import org.vertx.java.core.impl.DefaultVertxFactory; //導入依賴的package包/類
/**
 * Create a new instance of the transport.
 *
 * @param listener
 *        The TransportListener that will receive data from this Transport instance.
 * @param remoteLocation
 *        The remote location where this transport should connection to.
 */
public TcpTransport(TransportListener listener, URI remoteLocation) {
    this.listener = listener;
    this.remoteLocation = remoteLocation;

    this.vertx = new DefaultVertxFactory().createVertx();
    this.client = vertx.createNetClient();
}
 
開發者ID:fusesource,項目名稱:hawtjms,代碼行數:16,代碼來源:TcpTransport.java


注:本文中的org.vertx.java.core.impl.DefaultVertxFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。