Code example for Proxy

Methods: type

0
    public HttpConnection(HttpConfiguration config, int connectTimeout) throws IOException {
        this.config = config;
        String hostName = config.getHostName();
        int hostPort = config.getHostPort();
        Proxy proxy = config.getProxy();
        if(proxy == null || proxy.type() == Proxy.Type.HTTP) {
            socket = new Socket();
        } else { 
            socket = new Socket(proxy);
        } 
        socket.connect(new InetSocketAddress(hostName, hostPort), connectTimeout);
    } 
 
    public void closeSocketAndStreams() { 
        if(usingSecureSocket) {
            if (null != sslOutputStream) {
                OutputStream temp = sslOutputStream;
                sslOutputStream = null;
                try { 
                    temp.close();
                } catch (Exception ex) {