当前位置: 首页>>代码示例>>Java>>正文


Java XnioSsl类代码示例

本文整理汇总了Java中org.xnio.ssl.XnioSsl的典型用法代码示例。如果您正苦于以下问题:Java XnioSsl类的具体用法?Java XnioSsl怎么用?Java XnioSsl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XnioSsl类属于org.xnio.ssl包,在下文中一共展示了XnioSsl类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
@Override
public void connect(final ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, final XnioSsl ssl, final Pool<ByteBuffer> bufferPool, final OptionMap options) {
    ChannelListener<StreamConnection> openListener = new ChannelListener<StreamConnection>() {
        @Override
        public void handleEvent(StreamConnection connection) {
            handleConnected(connection, listener, uri, ssl, bufferPool, options);
        }
    };
    IoFuture.Notifier<StreamConnection, Object> notifier = new IoFuture.Notifier<StreamConnection, Object>() {
        @Override
        public void notify(IoFuture<? extends StreamConnection> ioFuture, Object o) {
            if (ioFuture.getStatus() == IoFuture.Status.FAILED) {
                listener.failed(ioFuture.getException());
            }
        }
    };
    if(bindAddress == null) {
        worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 8009 : uri.getPort()), openListener, options).addNotifier(notifier, null);
    } else {
        worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 8009 : uri.getPort()), openListener, null, options).addNotifier(notifier, null);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AjpClientProvider.java

示例2: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public IoFuture<ClientConnection> connect(InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    ClientProvider provider = getClientProvider(uri);
    final FutureResult<ClientConnection> result = new FutureResult<>();
    provider.connect(new ClientCallback<ClientConnection>() {
        @Override
        public void completed(ClientConnection r) {
            result.setResult(r);
        }

        @Override
        public void failed(IOException e) {
            result.setException(e);
        }
    }, bindAddress, uri, worker, ssl, bufferPool, options);
    return result.getIoFuture();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:UndertowClient.java

示例3: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
@Override
public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioWorker worker, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    if (uri.getScheme().equals("https")) {
        if (ssl == null) {
            listener.failed(UndertowMessages.MESSAGES.sslWasNull());
            return;
        }
        if (bindAddress == null) {
            ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        } else {
            ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        }
    } else {
        if (bindAddress == null) {
            worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        } else {
            worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options), null, options).addNotifier(createNotifier(listener), null);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:HttpClientProvider.java

示例4: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public IoFuture<ClientConnection> connect(InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) {
    ClientProvider provider = getClientProvider(uri);
    final FutureResult<ClientConnection> result = new FutureResult<>();
    provider.connect(new ClientCallback<ClientConnection>() {
        @Override
        public void completed(ClientConnection r) {
            result.setResult(r);
        }

        @Override
        public void failed(IOException e) {
            result.setException(e);
        }
    }, bindAddress, uri, worker, ssl, bufferPool, options);
    return result.getIoFuture();
}
 
开发者ID:networknt,项目名称:light-4j,代码行数:17,代码来源:Http2Client.java

示例5: start

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public void start() {
    try {

        OptionMap.Builder serverOptionsBuilder = OptionMap.builder()
                .set(Options.TCP_NODELAY, true)
                .set(Options.REUSE_ADDRESSES, true);
        ChannelListener acceptListener = ChannelListeners.openListenerAdapter(openListener);
        if (httpAddress != null) {
            normalServer = worker.createStreamConnectionServer(httpAddress, acceptListener, serverOptionsBuilder.getMap());
            normalServer.resumeAccepts();
        }
        if (secureAddress != null) {
            if (sslClientAuthMode != null) {
                serverOptionsBuilder.set(SSL_CLIENT_AUTH_MODE, sslClientAuthMode);
            }
            OptionMap secureOptions = serverOptionsBuilder.getMap();
            XnioSsl xnioSsl = new UndertowXnioSsl(worker.getXnio(), secureOptions, sslContext);
            secureServer = xnioSsl.createSslConnectionServer(worker, secureAddress, acceptListener, secureOptions);
            secureServer.resumeAccepts();
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:ManagementHttpServer.java

示例6: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
@Override
public void connect(final ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, final XnioSsl ssl, final Pool<ByteBuffer> bufferPool, final OptionMap options) {
    if(uri.getScheme().equals("spdy-plain")) {

        if(bindAddress == null) {
            worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, options), options).addNotifier(createNotifier(listener), null);
        } else {
            worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, options), null, options).addNotifier(createNotifier(listener), null);
        }
        return;
    }


    if(ALPN_PUT_METHOD == null) {
        listener.failed(UndertowMessages.MESSAGES.jettyNPNNotAvailable());
        return;
    }
    if (ssl == null) {
        listener.failed(UndertowMessages.MESSAGES.sslWasNull());
        return;
    }
    if(bindAddress == null) {
        ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, options), options).addNotifier(createNotifier(listener), null);
    } else {
        ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, options), options).addNotifier(createNotifier(listener), null);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:SpdyClientProvider.java

示例7: createOpenListener

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
private ChannelListener<StreamConnection> createOpenListener(final ClientCallback<ClientConnection> listener, final URI uri, final XnioSsl ssl, final Pool<ByteBuffer> bufferPool, final OptionMap options) {
    return new ChannelListener<StreamConnection>() {
        @Override
        public void handleEvent(StreamConnection connection) {
            handleConnected(connection, listener, uri, ssl, bufferPool, options);
        }
    };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SpdyClientProvider.java

示例8: handleConnected

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
private void handleConnected(StreamConnection connection, final ClientCallback<ClientConnection> listener, URI uri, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    if(connection instanceof SslConnection) {
        handlePotentialSpdyConnection(connection, listener, bufferPool, options, new ChannelListener<SslConnection>() {
            @Override
            public void handleEvent(SslConnection channel) {
                listener.failed(UndertowMessages.MESSAGES.spdyNotSupported());
            }
        });
    } else {
        listener.completed(createSpdyChannel(connection, bufferPool));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:SpdyClientProvider.java

示例9: addHost

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public synchronized LoadBalancingProxyClient addHost(final URI host, String jvmRoute, XnioSsl ssl) {

        Host h = new Host(jvmRoute, null, host, ssl, OptionMap.EMPTY);
        Host[] existing = hosts;
        Host[] newHosts = new Host[existing.length + 1];
        System.arraycopy(existing, 0, newHosts, 0, existing.length);
        newHosts[existing.length] = h;
        this.hosts = newHosts;
        if (jvmRoute != null) {
            this.routes.put(jvmRoute, h);
        }
        return this;
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:LoadBalancingProxyClient.java

示例10: ProxyConnectionPool

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public ProxyConnectionPool(ConnectionPoolManager connectionPoolManager, InetSocketAddress bindAddress,URI uri, XnioSsl ssl, UndertowClient client, OptionMap options) {
    this.connectionPoolManager = connectionPoolManager;
    this.maxConnections = Math.max(connectionPoolManager.getMaxConnections(), 1);
    this.maxCachedConnections = Math.max(connectionPoolManager.getMaxCachedConnections(), 0);
    this.sMaxConnections = Math.max(connectionPoolManager.getSMaxConnections(), 0);
    this.maxRequestQueueSize = Math.max(connectionPoolManager.getMaxQueueSize(), 0);
    this.ttl = connectionPoolManager.getTtl();
    this.bindAddress = bindAddress;
    this.uri = uri;
    this.ssl = ssl;
    this.client = client;
    this.options = options;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:ProxyConnectionPool.java

示例11: getConnection

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
private static ConnectionHandlerFactory getConnection ( SocketAddress destination, final String username, final String password,
        ConnectionProviderContextImpl context, ConnectionProvider instance, OptionMap options )
                throws IOException, InterruptedException, KeyManagementException, NoSuchProviderException, NoSuchAlgorithmException {
    XnioSsl xnioSsl = new JsseXnioSsl(context.getXnio(), options);
    FutureResult<ConnectionHandlerFactory> result = new FutureResult<ConnectionHandlerFactory>();
    instance.connect(null, destination, options, result, new CallbackHandler() {

        public void handle ( Callback[] callbacks ) throws IOException, UnsupportedCallbackException {

            for ( Callback cb : callbacks ) {

                if ( cb instanceof NameCallback ) {
                    ( (NameCallback) cb ).setName(username);
                }
                else if ( cb instanceof PasswordCallback ) {
                    ( (PasswordCallback) cb ).setPassword(password != null ? password.toCharArray() : new char[0]);
                }
                else if ( !( cb instanceof RealmCallback) ) {
                    System.err.println(cb);
                    throw new UnsupportedCallbackException(cb);
                }
            }
        }
    }, xnioSsl);

    System.err.println("waiting for connection");
    IoFuture<ConnectionHandlerFactory> ioFuture = result.getIoFuture();
    Status s = ioFuture.await(5, TimeUnit.SECONDS);
    if ( s == Status.FAILED ) {
        System.err.println("Cannot connect");
        if ( ioFuture.getException() != null ) {
            ioFuture.getException().printStackTrace(System.err);
        }
    }
    else if ( s != Status.DONE ) {
        ioFuture.cancel();
        System.err.println("Connect timeout");
        System.exit(-1);
    }

    ConnectionHandlerFactory chf = ioFuture.getInterruptibly();
    return chf;
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:44,代码来源:JBoss.java

示例12: handleConnected

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
private void handleConnected(StreamConnection connection, ClientCallback<ClientConnection> listener, URI uri, XnioSsl ssl, Pool<ByteBuffer> bufferPool, OptionMap options) {
    listener.completed(new AjpClientConnection(new AjpClientChannel(connection, bufferPool) , options, bufferPool));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:AjpClientProvider.java

示例13: Host

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
private Host(String jvmRoute, InetSocketAddress bindAddress, URI uri, XnioSsl ssl, OptionMap options) {
    this.connectionPool = new ProxyConnectionPool(this, bindAddress, uri, ssl, client, options);
    this.jvmRoute = jvmRoute;
    this.uri = uri;
    this.ssl = ssl;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:LoadBalancingProxyClient.java

示例14: connect

import org.xnio.ssl.XnioSsl; //导入依赖的package包/类
public static IoFuture<WebSocketChannel> connect(XnioWorker worker, XnioSsl ssl, final Pool<ByteBuffer> bufferPool, final OptionMap optionMap, final URI uri, WebSocketVersion version) {
    return connect(worker, ssl, bufferPool, optionMap, uri, version, null);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:WebSocketClient.java


注:本文中的org.xnio.ssl.XnioSsl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。