Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: how to connect to site through proxy

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to connect to site through proxy

    hi i am trying to connect to a sitte using a proxy at the moment im using tor as localhost but when browser launched it aint launched through tor just my norml connection any suggestions?
    code is below:
     
     public void launcher(String site){
            String input=site;
    try {
     
             //Desktop.getDesktop().browse(new URI("input"));
     
            if( !java.awt.Desktop.isDesktopSupported() ) {
                System.err.println( "Desktop is not supported (fatal)" );
                System.exit( 1 );
            } 
            if ( input.length() == 0 ) {
                System.err.println( "Empty string in launcher" );
                System.exit( 0 );
            }
              java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
            if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
     
                System.err.println( "Desktop doesn't support the browse action (fatal)" );
                System.exit( 1 );
            }
            String web=input;
            try {
                    System.setProperty("SOCKS.proxyHost", "127.0.0.1");//tor local host
                    System.setProperty("SOCKS.proxyPort", "9050");
                    java.net.URI uri = new java.net.URI( web );//site to visit
                    desktop.browse( uri );
                }
                catch ( Exception e ) {
     
                    System.err.println( e.getMessage() );
                }
    }catch(Exception t){
        System.out.println("launcher fuckup");
    }
     }//end launcher
    Last edited by stac; March 13th, 2013 at 08:27 AM. Reason: format


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to connect to site through proxy

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 0
    Last Post: March 27th, 2012, 08:00 AM
  2. [SOLVED] Proxy authentication
    By jaya in forum Java Networking
    Replies: 2
    Last Post: January 27th, 2011, 04:04 AM
  3. Site to site communication (applet)
    By sanyi007 in forum Java Theory & Questions
    Replies: 0
    Last Post: May 16th, 2010, 07:19 AM