Return-Path: X-Original-To: apmail-mina-users-archive@www.apache.org Delivered-To: apmail-mina-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9CBC517F55 for ; Sun, 19 Apr 2015 16:36:52 +0000 (UTC) Received: (qmail 44984 invoked by uid 500); 19 Apr 2015 16:36:52 -0000 Delivered-To: apmail-mina-users-archive@mina.apache.org Received: (qmail 44924 invoked by uid 500); 19 Apr 2015 16:36:52 -0000 Mailing-List: contact users-help@mina.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@mina.apache.org Delivered-To: mailing list users@mina.apache.org Received: (qmail 44912 invoked by uid 99); 19 Apr 2015 16:36:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2015 16:36:51 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: message received from 54.191.145.13 which is an MX secondary for users@mina.apache.org) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2015 16:36:45 +0000 Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 12ED52143E for ; Sun, 19 Apr 2015 16:36:25 +0000 (UTC) Received: by obbeb7 with SMTP id eb7so102626594obb.3 for ; Sun, 19 Apr 2015 09:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=FMWQvMb1U0ynhWjkCN802H33F5VuLAXxEHj3QIwJ9Hk=; b=B1rBNvfeC0/KWLAs26ZNFp+Qyp4ixP/g9bsUho1Gu0JUvGXHy8w6GLT27mmkpBd4mm yBmn2vXBxFfZg0eA2Vs69++6aoxN6IG1ybzia9rg5QHg9gpe60rRm734u9MSUidXJvt2 UTgvA9ShyzQ1DZjpSGsjELW0T1xS+q9YqEBLZTq1b5ydgZ35IadKY/oN2s9wcM0CWpEd 2fQf9ar6PDdVnjAWXmGeJC6XtR9uVr0NQtS9Ss9CB1yX9UKMa9nn+UyLbkgMQ6eV9Hx5 7FjW9vmv187QJmfZBjvuqjojUioaa6l1w+wJ/llFdySRKORbjod8IDXjHqnvrg2C5cS9 kj7A== MIME-Version: 1.0 X-Received: by 10.60.179.6 with SMTP id dc6mr1699459oec.74.1429461384501; Sun, 19 Apr 2015 09:36:24 -0700 (PDT) Received: by 10.76.20.100 with HTTP; Sun, 19 Apr 2015 09:36:24 -0700 (PDT) Date: Sun, 19 Apr 2015 09:36:24 -0700 Message-ID: Subject: How to force SslFilter to use sslContext.createSSLEngine(peer.getHostName(), peer.getPort()) From: "Jianbao (Jim) Tao" To: users@mina.apache.org Content-Type: multipart/alternative; boundary=089e0117611b0b21600514166a37 X-Virus-Checked: Checked by ClamAV on apache.org --089e0117611b0b21600514166a37 Content-Type: text/plain; charset=UTF-8 Hi, I have a use case where I need to connect to a remote server that requires SNI. I am using mina version 2.0.0-M6. In org.apache.mina.filter.ssl.SslHandler, I see this code: InetSocketAddress peer = (InetSocketAddress) session .getAttribute(SslFilter.PEER_ADDRESS); // Create the SSL engine here if (peer == null) { sslEngine = sslContext.createSSLEngine(); } else { sslEngine = sslContext.createSSLEngine(peer.getHostName(), peer.getPort()); } However, the problem is, I don't know how to add SslFilter.PEER_ADDRESS attribute so that it will be available when SslHandler creates sslEngine. This is how I connect to the remote server: ExecutorService connectorPool = Executors.newFixedThreadPool(20); NioProcessor connectorProcessor = new NioProcessor(connectorPool); NioSocketConnector connector = new NioSocketConnector(connectorPool, connectorProcessor); connector.setHandler(new DummyIoHandler()); connector.getFilterChain().addLast("httpCodec", new ProtocolCodecFilter(new HttpCodecFactory())); SSLConnectorFilter sslConnectorFilter = new SSLConnectorFilter(); // extends SslFilter and wraps a custom SSLContext connector.getFilterChain().addFirst("ssl", sslConnectorFilter); connector.connect(address); Thanks in advance for your help. --089e0117611b0b21600514166a37--