You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Campbell, Adam" <Ad...@team.neustar.INVALID> on 2019/03/07 00:52:32 UTC

Netty4 Component SSLHandler ChannelHandlerFactory Inconsistency

Hi Camel devs,

I was looking into the source code for Netty4 component and I found one potential inconsistency.

Here there is a check for if SslHandler is an instanceof ChannelHandlerFactory

boolean factory = sslHandler instanceof ChannelHandlerFactory;
https://github.com/apache/camel/blob/camel-2.23.x/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java#L156

However, unlike the encoders/decoders it seems there is no call to the newChannelHandler method in this case so it seems that extending SslHandler and implementing ChannelHandlerFactory interface does not work as expected.
https://github.com/apache/camel/blob/master/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java#L87

Hence I am seeing below error when I did the same:
io.netty.handler.ssl.SslHandler is not a @Sharable handler, so can't be added or removed multiple times.

I'm not sure if this is a bug or if I'm misunderstanding something. Does anyone know why sslHandler was not implemented with the ChannelHandlerFactory logic similar to encoders/decoders?

Thanks,
Adam

Re: Netty4 Component SSLHandler ChannelHandlerFactory Inconsistency

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah yeah if you set a custom ssl handler, then yeah we can add support
for this. You are welcome to log a JIRA and provide a github PR

On Thu, Mar 7, 2019 at 1:52 AM Campbell, Adam
<Ad...@team.neustar.invalid> wrote:
>
> Hi Camel devs,
>
> I was looking into the source code for Netty4 component and I found one potential inconsistency.
>
> Here there is a check for if SslHandler is an instanceof ChannelHandlerFactory
>
> boolean factory = sslHandler instanceof ChannelHandlerFactory;
> https://github.com/apache/camel/blob/camel-2.23.x/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java#L156
>
> However, unlike the encoders/decoders it seems there is no call to the newChannelHandler method in this case so it seems that extending SslHandler and implementing ChannelHandlerFactory interface does not work as expected.
> https://github.com/apache/camel/blob/master/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java#L87
>
> Hence I am seeing below error when I did the same:
> io.netty.handler.ssl.SslHandler is not a @Sharable handler, so can't be added or removed multiple times.
>
> I'm not sure if this is a bug or if I'm misunderstanding something. Does anyone know why sslHandler was not implemented with the ChannelHandlerFactory logic similar to encoders/decoders?
>
> Thanks,
> Adam



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2