Hi, On 5/14/07, lichunlei <[EMAIL PROTECTED]> wrote:
Sir,I am a java coder coming from China. And now, our company is using Mina to develop a project. Recently, we have a question: How to use socket proxy in mina? Our socket Server program is hinding a firewall, so our client have to use a socket proxy to visit server. Below is our code for connecting to server: private static final String HOSTNAME = "130.208.0.76"; private static final int PORT = 5678; String proxyHost = "192.168.0.76"; String proxyPort = "1080"; System.getProperties().put("socksProxySet","true"); System.getProperties().put("socksProxyHost",proxyHost); System.getProperties().put("socksProxyPort",proxyPort); SocketConnector connector = new SocketConnector(); SocketConnectorConfig cfg = new SocketConnectorConfig(); cfg.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new HostProtocolCodecFactory())); ConnectFuture future = connector.connect(new InetSocketAddress( HOSTNAME, PORT), new ClientSessionHandler(), cfg ); future.join(); But future.isConnected() is false. I want to know how to set socket proxy in Mina?
The default socket transport implementation of Apache MINA use Java NIO, and Java NIO doesn't allow us to use a socket proxy (or SocketFactory strictly speaking) by its specification. There's no known way to work around it. Like we did for SSL, we need to implement it using an IoFilter, but it's quite a big task. One reasonable alternative could be implementing a blocking I/O transport implementation for MINA which will not be that hard. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
