Merge pull request #64 in ITERATE/cyberduck from feature/windows/9074 to master
[cyberduck.git] / source / ch / cyberduck / core / socket / HttpProxySocketFactory.java
blobc1fc38d641a911e871cdd61db5a926831be3e4e3
1 package ch.cyberduck.core.socket;
3 /*
4 * Copyright (c) 2002-2015 David Kocher. All rights reserved.
5 * http://cyberduck.ch/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch
20 import org.apache.commons.net.DefaultSocketFactory;
22 import java.io.IOException;
23 import java.net.InetAddress;
24 import java.net.Proxy;
25 import java.net.Socket;
27 /**
28 * @version $Id$
30 public class HttpProxySocketFactory extends DefaultSocketFactory {
32 private final Proxy proxy;
34 public HttpProxySocketFactory(final Proxy proxy) {
35 this.proxy = proxy;
38 @Override
39 public Socket createSocket() throws IOException {
40 return new HttpProxyAwareSocket(proxy);
43 @Override
44 public Socket createSocket(final String host, final int port) throws IOException {
45 return super.createSocket(host, port);
48 @Override
49 public Socket createSocket(final InetAddress address, final int port) throws IOException {
50 return super.createSocket(address, port);
53 @Override
54 public Socket createSocket(final String host, final int port, final InetAddress localAddr, final int localPort) throws IOException {
55 return super.createSocket(host, port, localAddr, localPort);
58 @Override
59 public Socket createSocket(final InetAddress address, final int port, final InetAddress localAddr, final int localPort) throws IOException {
60 return super.createSocket(address, port, localAddr, localPort);