Tuesday, August 17, 2010

Small Proxy App based on Apache Mina 2.0.0-RC1

What I'm going to do is develop a small app which basically is going to broadcast a message received to another host in a defined port.
My small app is just a standalone app based on Apache Mina, is going to be listening on "X" port and it's going to broadcast message received to another app which is a blackbox. So simple, Isn't it?


What do you need?
  • mina-filter-compression-2.0.0-RC1.jar
  • mina-integration-xbean-2.0.0-RC1.jar
  • slf4j-log4j12-1.5.0.jar
  • mina-integration-beans-2.0.0-RC1.jar
  • jzlib-1.0.7.jar
  • jaxen-1.1.1.jar
  • mina-transport-apr-2.0.0-RC1.jar
  • log4j-1.2.15.jar
  • slf4j-api-1.5.0.jar
  • mina-core-2.0.0-RC1.jar
Or simple, you can get the full distribution and get them all in one single file.
This jar is just a luxury, but it's necesary, because I don't want to reinvent the wheel: commons-lang-2.3.jar

Well, time to work, the first thing you should code is the main class, my ProxyServer and 2 IoHandlers (ProxyHandlerAdapter & ClientHandlerAdapter).


And this is my code







How can I test it??? Just by create a client using java.net.Socket or just by using Telnet to that particular port

I didn't include other classes because they're not important

1 comment:

  1. Hi,
    Great stuff !! But.. still not work :)
    Where the ReceiverFactory class come from ? Apache Qpid ? I didn't find any version mayching this class(all latest version of Qpid dont integrate this class anymore)

    Ty for help
    Yannick Lacaute

    ReplyDelete