You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by bea <st...@yahoo.com> on 2007/07/13 20:30:31 UTC

Does mina suppot SOCKS proxy connections?

Will it work if I set the socksProxyHost system property? Or is there some
connector available that uses proxies? Thank you for your help.


Monika


-- 
View this message in context: http://www.nabble.com/Does-mina-suppot-SOCKS-proxy-connections--tf4076194.html#a11585081
Sent from the mina dev mailing list archive at Nabble.com.


Re: Does mina suppot SOCKS proxy connections?

Posted by mat <fo...@gmail.com>.
Agree. If Mina doesn't support proxy, it really will be a problem in many
projects.

On 7/14/07, bea <st...@yahoo.com> wrote:
>
>
> Does anyone have any pointers on how to add support for this?
> Unfortunately,
> SOCKS is critical for my project. If I am not able to use the Proxy
> functionality provided by the jdk using Mina, Mina is going to have to go
> :(.
>
> Thanks for any suggestions.
>
>
>
>
>
> mheath wrote:
> >
> > On 7/13/07, bea <st...@yahoo.com> wrote:
> >>
> >> Will it work if I set the socksProxyHost system property? Or is there
> >> some
> >> connector available that uses proxies? Thank you for your help.
> >
> > No.  Java NIO does not support using a Proxy.  There has been talk
> > about adding support to MINA for communicating with a SOCKS or HTTP
> > proxy.
> >
> > This issue https://issues.apache.org/jira/browse/DIRMINA-223 is
> > tracking the request for proxy support.
> >
> > -Mike
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Does-mina-suppot-SOCKS-proxy-connections--tf4076194.html#a11589402
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: Does mina suppot SOCKS proxy connections?

Posted by 向秦贤 <fy...@gmail.com>.
hi, stupidbea:)
maybe you can try com.jcraft.jsch.Proxy, I wanna to do with it, but not try
it.:)

follow code from eclipse cvs
org.eclipse.team.internal.ccvs.core.connection.PServerConnection.
/**
     * @see Connection#doOpen()
     */
    public void open(IProgressMonitor monitor) throws IOException,
CVSAuthenticationException {

        monitor.subTask(CVSMessages.PServerConnection_authenticating);
        monitor.worked(1);

        InputStream is = null;
        OutputStream os = null;

        Proxy proxy = getProxy();
        if (proxy!=null) {
          String host = cvsroot.getHost();
          int port = cvsroot.getPort();
          if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
            port = DEFAULT_PORT;
          }
          try {
            int timeout = CVSProviderPlugin.getPlugin().getTimeout() * 1000;
            IJSchService service = CVSProviderPlugin.getPlugin
().getJSchService();
            service.connect(proxy, host, port, timeout, monitor);
          } catch( Exception ex) {
            ex.printStackTrace();
            throw new IOException(ex.getMessage());
          }
          is = proxy.getInputStream();
          os = proxy.getOutputStream();

        } else {
          fSocket = createSocket(monitor);
          is = fSocket.getInputStream();
          os = fSocket.getOutputStream();
        }

        boolean connected = false;
        try {
            this.inputStream = new BufferedInputStream(new
PollingInputStream(is,
                cvsroot.getTimeout(), monitor));
            this.outputStream = new PollingOutputStream(new
TimeoutOutputStream(
                os, 8192 /*bufferSize*/, 1000 /*writeTimeout*/, 1000
/*closeTimeout*/),
                cvsroot.getTimeout(), monitor);
            authenticate();
            connected = true;
        } finally {
            if (! connected) cleanUpAfterFailedConnection();
        }
    }

    private Proxy getProxy() {
        IJSchService service = CVSProviderPlugin.getPlugin
().getJSchService();
        if (service == null)
            return null;
        Proxy proxy = service.getProxyForHost(cvsroot.getHost(),
IProxyData.SOCKS_PROXY_TYPE);
        if (proxy == null)
            proxy = service.getProxyForHost(cvsroot.getHost(),
IProxyData.HTTPS_PROXY_TYPE);
        return proxy;
    }


2007/7/14, bea <st...@yahoo.com>:
>
>
> Does anyone have any pointers on how to add support for this?
> Unfortunately,
> SOCKS is critical for my project. If I am not able to use the Proxy
> functionality provided by the jdk using Mina, Mina is going to have to go
> :(.
>
> Thanks for any suggestions.
>
>
>
>
>
> mheath wrote:
> >
> > On 7/13/07, bea <st...@yahoo.com> wrote:
> >>
> >> Will it work if I set the socksProxyHost system property? Or is there
> >> some
> >> connector available that uses proxies? Thank you for your help.
> >
> > No.  Java NIO does not support using a Proxy.  There has been talk
> > about adding support to MINA for communicating with a SOCKS or HTTP
> > proxy.
> >
> > This issue https://issues.apache.org/jira/browse/DIRMINA-223 is
> > tracking the request for proxy support.
> >
> > -Mike
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Does-mina-suppot-SOCKS-proxy-connections--tf4076194.html#a11589402
> Sent from the mina dev mailing list archive at Nabble.com.
>
>


-- 
向秦贤

Re: Does mina suppot SOCKS proxy connections?

Posted by bea <st...@yahoo.com>.
Does anyone have any pointers on how to add support for this? Unfortunately,
SOCKS is critical for my project. If I am not able to use the Proxy
functionality provided by the jdk using Mina, Mina is going to have to go
:(.

Thanks for any suggestions.





mheath wrote:
> 
> On 7/13/07, bea <st...@yahoo.com> wrote:
>>
>> Will it work if I set the socksProxyHost system property? Or is there
>> some
>> connector available that uses proxies? Thank you for your help.
> 
> No.  Java NIO does not support using a Proxy.  There has been talk
> about adding support to MINA for communicating with a SOCKS or HTTP
> proxy.
> 
> This issue https://issues.apache.org/jira/browse/DIRMINA-223 is
> tracking the request for proxy support.
> 
> -Mike
> 
> 

-- 
View this message in context: http://www.nabble.com/Does-mina-suppot-SOCKS-proxy-connections--tf4076194.html#a11589402
Sent from the mina dev mailing list archive at Nabble.com.


Re: Does mina suppot SOCKS proxy connections?

Posted by Mike Heath <mh...@apache.org>.
On 7/13/07, bea <st...@yahoo.com> wrote:
>
> Will it work if I set the socksProxyHost system property? Or is there some
> connector available that uses proxies? Thank you for your help.

No.  Java NIO does not support using a Proxy.  There has been talk
about adding support to MINA for communicating with a SOCKS or HTTP
proxy.

This issue https://issues.apache.org/jira/browse/DIRMINA-223 is
tracking the request for proxy support.

-Mike