Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1493#discussion_r59633131 --- Diff: utils/src/main/java/com/cloud/utils/nio/NioClient.java --- @@ -36,52 +36,39 @@ private static final Logger s_logger = Logger.getLogger(NioClient.class); protected String _host; - protected String _bindAddress; protected SocketChannel _clientConnection; public NioClient(final String name, final String host, final int port, final int workers, final HandlerFactory factory) { super(name, port, workers, factory); _host = host; } - public void setBindAddress(final String ipAddress) { - _bindAddress = ipAddress; - } - @Override protected void init() throws IOException { _selector = Selector.open(); Task task = null; try { _clientConnection = SocketChannel.open(); - _clientConnection.configureBlocking(true); - s_logger.info("Connecting to " + _host + ":" + _port); - - if (_bindAddress != null) { - s_logger.info("Binding outbound interface at " + _bindAddress); - - final InetSocketAddress bindAddr = new InetSocketAddress(_bindAddress, 0); - _clientConnection.socket().bind(bindAddr); - } + s_logger.info("Connecting to " + _host + ":" + _port); final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); _clientConnection.connect(peerAddr); - - SSLEngine sslEngine = null; - // Begin SSL handshake in BLOCKING mode - _clientConnection.configureBlocking(true); + _clientConnection.configureBlocking(false); final SSLContext sslContext = Link.initSSLContext(true); - sslEngine = sslContext.createSSLEngine(_host, _port); + SSLEngine sslEngine = sslContext.createSSLEngine(_host, _port); sslEngine.setUseClientMode(true); sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols())); - - Link.doHandshake(_clientConnection, sslEngine, true); + sslEngine.beginHandshake(); + if (!Link.doHandshake(_clientConnection, sslEngine)) { + s_logger.error("SSL Handshake failed!"); + _selector.close(); + throw new IOException("SSL Handshake failed!"); --- End diff -- Please include ``_host`` and ``_port`` in the error message to assist with operational debugging.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---