Hello,

I tried to create a connexion on a remote server, I have to use a proxy (squid) to access to the remote server.

here a simple code:

System.setProperty("socksProxyHost", ipProxy);
System.setProperty("socksProxyPort", port);

Authenticator.setDefault(new MyAuthenticator());
FTPClient client = new FTPClient();
try {
       System.out.println("connect...");
       client.connect("ca.expasy.org", 21);
       System.out.println("login...");
       client.login("anonymous", "[EMAIL PROTECTED]");
       } catch (IOException e) {
           e.printStackTrace();
           System.err.println(e.getLocalizedMessage());
       }

public class MyAuthenticator extends Authenticator {
   protected PasswordAuthentication getPasswordAuthentication() {
       System.out.println("*** getPasswordAuthentication *** ");
       return new PasswordAuthentication( "login","password" );
   }
}

the result is :
Test:
    [java] connect...

    [java] java.net.SocketException: Malformed reply from SOCKS server
[java] at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:87) [java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:429)
    [java]     at java.net.Socket.connect(Socket.java:519)
    [java]     at java.net.Socket.connect(Socket.java:469)
    [java]     at java.net.Socket.<init>(Socket.java:366)
    [java]     at java.net.Socket.<init>(Socket.java:180)
[java] at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53) [java] at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
    [java]     at Test.main(Test.java:51)
    [java] Malformed reply from SOCKS server


I tried to set a lot of system properties (socksProxySet,ftpProxySet,...,socks.proxyHost,....) but nothing works...
someone have any idea?

Olivier

--

Filangi Olivier
OUEST-genopole Bio-Informatics Platform
Symbiose Team, IRISA-INRIA
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 87, Fax: +33 (0) 2 99 84 71 71

Biomaj Project : http://biomaj.gforge.inria.fr/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to