Package org.jivesoftware.openfire.nio
Class NettyOutboundConnectionHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<String>
-
- org.jivesoftware.openfire.nio.NettyConnectionHandler
-
- org.jivesoftware.openfire.nio.NettyOutboundConnectionHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
public class NettyOutboundConnectionHandler extends NettyConnectionHandler
Outbound (S2S) specific ConnectionHandler that knows which subclass ofStanzaHandler
should be created and how to build and configure aNettyConnection
.- Author:
- Matthew Vivian, Alex Gidman
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.nio.NettyConnectionHandler
configuration, CONNECTION, IDLE_FLAG, PARSER_CACHE, READ_BYTES, sslInitDone, WRITTEN_BYTES
-
-
Constructor Summary
Constructors Constructor Description NettyOutboundConnectionHandler(ConnectionConfiguration configuration, DomainPair domainPair, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
channelActive(io.netty.channel.ChannelHandlerContext ctx)
DomainPair
getDomainPair()
Duration
getMaxIdleTime()
Returns the time that a connection can be idle before being closed.int
getPort()
void
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
String
toString()
void
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)
Called when SSL Handshake has been completed.-
Methods inherited from class org.jivesoftware.openfire.nio.NettyConnectionHandler
channelRead0, channelUnregistered, exceptionCaught, handlerRemoved
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
-
-
-
Constructor Detail
-
NettyOutboundConnectionHandler
public NettyOutboundConnectionHandler(ConnectionConfiguration configuration, DomainPair domainPair, int port)
-
-
Method Detail
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
getMaxIdleTime
public Duration getMaxIdleTime()
Description copied from class:NettyConnectionHandler
Returns the time that a connection can be idle before being closed.- Specified by:
getMaxIdleTime
in classNettyConnectionHandler
- Returns:
- the time a connection can be idle.
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classNettyConnectionHandler
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
Called when SSL Handshake has been completed. If successful, attempts authentication via SASL, or dialback dependent on configuration and certificate validity. If not successful, either attempts dialback on a plain un-encrypted connection, or throws an exception dependent on configuration.- Specified by:
userEventTriggered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
userEventTriggered
in classNettyConnectionHandler
- Parameters:
ctx
- ChannelHandlerContext for the Netty channelevt
- Event that has been triggered - this implementation specifically identifies SslHandshakeCompletionEvent- Throws:
Exception
-
getDomainPair
public DomainPair getDomainPair()
-
getPort
public int getPort()
-
toString
public String toString()
- Overrides:
toString
in classNettyConnectionHandler
-
-