org.jboss.netty.handler.ipfilter

## Class OneIpFilterHandler

- java.lang.Object
- - org.jboss.netty.handler.ipfilter.IpFilteringHandlerImpl
  - - org.jboss.netty.handler.ipfilter.OneIpFilterHandler

All Implemented Interfaces:
  ChannelHandler, ChannelUpstreamHandler, IpFilteringHandler

    @ChannelHandler.Sharable
    public class OneIpFilterHandler
    extends IpFilteringHandlerImpl

Handler that block any new connection if there are already a currently active channel connected with the same InetAddress (IP).

Take care to not change isBlocked method except if you know what you are doing since it is used to test if the current closed connection is to be removed or not from the map of currently connected channel.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler

`ChannelHandler.Sharable`

### Constructor Summary

Constructors
Constructor and Description
`OneIpFilterHandler()`

### Method Summary

Methods
`protected boolean` `accept(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress)` Called when the channel is connected.
`void` `handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)` Handles the specified upstream event.

### Methods inherited from class org.jboss.netty.handler.ipfilter.IpFilteringHandlerImpl

`continues, handleAllowedChannel, handleRefusedChannel, isBlocked, removeIpFilterListener, setIpFilterListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### OneIpFilterHandler

    public OneIpFilterHandler()

### Method Detail

#### accept

    protected boolean accept(ChannelHandlerContext ctx,
                 ChannelEvent e,
                 InetSocketAddress inetSocketAddress)
                      throws Exception

Description copied from class: `IpFilteringHandlerImpl`
Called when the channel is connected. It returns True if the corresponding connection is to be allowed. Else it returns False.

Specified by:
  `accept` in class `IpFilteringHandlerImpl`
  `inetSocketAddress` - the remote `InetSocketAddress` from client
Returns:
  True if the corresponding connection is allowed, else False.
Throws:
  `Exception`

#### handleUpstream

    public void handleUpstream(ChannelHandlerContext ctx,
                      ChannelEvent e)
                        throws Exception

Description copied from interface: `ChannelUpstreamHandler`
Handles the specified upstream event.

Specified by:
  `handleUpstream` in interface `ChannelUpstreamHandler`
Overrides:
  `handleUpstream` in class `IpFilteringHandlerImpl`
Parameters:
  `ctx` - the context object for this handler
  `e` - the upstream event to process or intercept
Throws:
  `Exception`