this.socket.getOutputStream().write(requestPacket, 0, 9 + getUser().length());
this.socket.getOutputStream().write(requestPacket, 0, methodCount + 2);
    public Socket connect(String host, int port) throws ProxyConnectionException {        setPrimaryConnectionPort(port);                InetSocketAddress isa = null;                try {            isa = new InetSocketAddress( InetAddress.getByName(host), port );        }catch(IOException ioe) {            throw new ProxyConnectionException(-2, "SOCK4 - IOException: " + ioe.getMessage());        }                InetAddress addr = isa.getAddress();        byte[] hostbytes = addr.getAddress();        byte[] requestPacket = new byte[300];        byte[] response = new byte[2];                requestPacket[0] = 5; // means socks5 (field VN)        requestPacket[1] = 3; // methods count (field NMETHODS)        requestPacket[2] = 0; // X'00' NO AUTHENTICATION REQUIRED//        requestPacket[3] = 1; // X'01' GSSAPI        if (getUser() != null && getPass() != null)        	requestPacket[3] = 2; // X'02' USERNAME/PASSWORD        try {            connectToProxy();                        this.socket.getOutputStream().write(requestPacket, 0, 9 + getUser().length());            this.socket.getInputStream().read(response, 0, 2);        }catch(IOException ioe) {            throw new ProxyConnectionException(-2, "SOCK4 - IOException: " + ioe.getMessage());        }                // negotiation for connect method completed        log.debug("Using method: " + response[1]);                if (response[1] == 0) { // NO AUTHENTICATION REQUIRED        	return request(hostbytes);//        }else if (response[1] == 1) { // GSSAPI        	        }else if (response[1] == 2) { // USERNAME/PASSWORD        	if(authUserPass(hostbytes))        		return request(hostbytes);        }                return null;    }