Example usage for io.vertx.core Vertx createNetServer

List of usage examples for io.vertx.core Vertx createNetServer

Introduction

In this page you can find the example usage for io.vertx.core Vertx createNetServer.

Prototype

NetServer createNetServer(NetServerOptions options);

Source Link

Document

Create a TCP/SSL server using the specified options

Usage

From source file:examples.NetExamples.java

License:Open Source License

public void example2(Vertx vertx) {

    NetServerOptions options = new NetServerOptions().setPort(4321);
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void exampleNetworkActivityLoggingOnServer(Vertx vertx) {

    NetServerOptions options = new NetServerOptions().setLogActivity(true);

    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example17(Vertx vertx) {
    NetServerOptions options = new NetServerOptions().setSsl(true).setKeyStoreOptions(new JksOptions()
            .setPath("/path/to/your/server-keystore.jks").setPassword("password-of-your-keystore"));
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example18(Vertx vertx) {
    Buffer myKeyStoreAsABuffer = vertx.fileSystem().readFileBlocking("/path/to/your/server-keystore.jks");
    JksOptions jksOptions = new JksOptions().setValue(myKeyStoreAsABuffer)
            .setPassword("password-of-your-keystore");
    NetServerOptions options = new NetServerOptions().setSsl(true).setKeyStoreOptions(jksOptions);
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example19(Vertx vertx) {
    NetServerOptions options = new NetServerOptions().setSsl(true).setPfxKeyCertOptions(new PfxOptions()
            .setPath("/path/to/your/server-keystore.pfx").setPassword("password-of-your-keystore"));
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example20(Vertx vertx) {
    Buffer myKeyStoreAsABuffer = vertx.fileSystem().readFileBlocking("/path/to/your/server-keystore.pfx");
    PfxOptions pfxOptions = new PfxOptions().setValue(myKeyStoreAsABuffer)
            .setPassword("password-of-your-keystore");
    NetServerOptions options = new NetServerOptions().setSsl(true).setPfxKeyCertOptions(pfxOptions);
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example21(Vertx vertx) {
    NetServerOptions options = new NetServerOptions().setSsl(true).setPemKeyCertOptions(new PemKeyCertOptions()
            .setKeyPath("/path/to/your/server-key.pem").setCertPath("/path/to/your/server-cert.pem"));
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example22(Vertx vertx) {
    Buffer myKeyAsABuffer = vertx.fileSystem().readFileBlocking("/path/to/your/server-key.pem");
    Buffer myCertAsABuffer = vertx.fileSystem().readFileBlocking("/path/to/your/server-cert.pem");
    PemKeyCertOptions pemOptions = new PemKeyCertOptions().setKeyValue(myKeyAsABuffer)
            .setCertValue(myCertAsABuffer);
    NetServerOptions options = new NetServerOptions().setSsl(true).setPemKeyCertOptions(pemOptions);
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example23(Vertx vertx) {
    NetServerOptions options = new NetServerOptions().setSsl(true).setClientAuth(ClientAuth.REQUIRED)
            .setTrustStoreOptions(new JksOptions().setPath("/path/to/your/truststore.jks")
                    .setPassword("password-of-your-truststore"));
    NetServer server = vertx.createNetServer(options);
}

From source file:examples.NetExamples.java

License:Open Source License

public void example24(Vertx vertx) {
    Buffer myTrustStoreAsABuffer = vertx.fileSystem().readFileBlocking("/path/to/your/truststore.jks");
    NetServerOptions options = new NetServerOptions().setSsl(true).setClientAuth(ClientAuth.REQUIRED)
            .setTrustStoreOptions(new JksOptions().setValue(myTrustStoreAsABuffer)
                    .setPassword("password-of-your-truststore"));
    NetServer server = vertx.createNetServer(options);
}