Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-645

SslFilter should start initiating handshake from sesionCreated() rather than from onPostAdd()

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M3
    • Fix Version/s: 2.0.7
    • Component/s: Filter
    • Labels:
      None

      Description

      Here's the situation I needed to get working. We want to make a secure connection through a SOCKS 5 proxy. So, one would think that just using the SslFilter and and the ProxyConnector (which adds the ProxyFilter at the bottom of the stack) would just do it. Unfortunately, it does not work quite right out of the box. The ProxyFilter only fully initializes itself after the sessionCreated() method is called. Meanwhile, the SslFilter tries to start the handshake (i.e. calls initiateHandshake()) from the onPostAdd() method, which occurs before the sessionCreated() is called.

      Moving the initiateHandshake() from onPostAdd() to sessionCreated() in SslFilter, as shown below, seems to fix the problem.

      @Override
      public void onPostAdd(IoFilterChain parent, String name,
      NextFilter nextFilter) throws SSLException {
      // if (autoStart)

      { // initiateHandshake(nextFilter, parent.getSession()); // }

      }

      @Override
      public void sessionCreated(NextFilter nextFilter, IoSession session)
      throws Exception {
      super.sessionCreated(nextFilter, session);

      if (autoStart)

      { initiateHandshake(nextFilter, session); }

      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dumitriu Dan Mihai Dumitriu
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified