Le 28/01/16 13:33, Norbert Irmer a écrit :
> Your idea, adding a method  "public void initiateHandshake(IoSession 
> session)" to the SslFilter class,
> would be perfectly fine for me.
>
> I just tested it, and it works fine. Only thing, perhaps, is, that I don't 
> know, if session.getFilterChain
> can return null, so perhaps some null pointer handling is necessary.
>  
>
Yes, actually, I have a better implementation that tests corner cases :

    public void initiateHandshake(IoSession session) throws SSLException {
        IoFilterChain filterChain = session.getFilterChain();
       
        if (filterChain == null) {
            throw new SSLException("No filter chain");
        }
       
        IoFilter.NextFilter nextFilter =
filterChain.getNextFilter(SslFilter.class);
       
        if (nextFilter == null) {
            throw new SSLException("No SSL next filter in the chain");
        }
       
        initiateHandshake(nextFilter, session);
    }


This is what I'm going to commit.

Reply via email to