[ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Webb reopened DIRMINA-389: ------------------------------- ----- SERVER CODE ----- public class ConnFilterServer extends IoHandlerAdapter { protected static final int PORT = 5678; public ConnFilterServer() throws IOException{ IoAcceptor acceptor = new SocketAcceptor(); ConnectionThrottleFilter ctFilter = new ConnectionThrottleFilter(); acceptor.getFilterChain().addLast("ConnThrottle", ctFilter); acceptor.setHandler( this ); acceptor.setLocalAddress( new InetSocketAddress(PORT)); acceptor.bind(); System.out.println("Connection Filter Server running..."); } public void sessionClosed(IoSession session) throws Exception { SessionLog.info( session, "The session has been closed" ); } public static void main(String[] args) throws IOException { new ConnFilterServer(); } } --- END SERVER CODE ---- ---CLIENT CODE--- public class ConnFilterClient extends IoHandlerAdapter implements IoFutureListener { public ConnFilterClient(){ makeConnection( "localhost", ConnFilterServer.PORT ); makeConnection( "localhost", ConnFilterServer.PORT ); } private void makeConnection( String host, int port){ IoConnector connector = new SocketConnector(); connector.setHandler( this ); ConnectFuture connFuture = connector.connect( new InetSocketAddress(host,port)); connFuture.addListener( this ); } public void operationComplete(IoFuture future) { if( future instanceof ConnectFuture ){ ConnectFuture connFuture = (ConnectFuture)future; if( connFuture.isConnected() ){ System.out.println("Connected..."); IoSession session = connFuture.getSession(); session.write( ByteBuffer.wrap("Hello World".getBytes()) ); } } } public static void main(String[] args) { new ConnFilterClient(); } } --- END CLIENT CODE --- > Create a Connection Throttle Filter > ----------------------------------- > > Key: DIRMINA-389 > URL: https://issues.apache.org/jira/browse/DIRMINA-389 > Project: MINA > Issue Type: New Feature > Components: Filter > Affects Versions: 2.0.0-M1 > Environment: All > Reporter: Mark Webb > Assignee: Mark Webb > Priority: Minor > Fix For: 2.0.0-M1 > > > Create a filter that will throttle connections. This filter will monitor > newly created sessions and if new connections from the same IP address come > in too fast, drop the connections. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.