title: How to bypass the proxy using java
body: <p>Here belwo is my code </p>
  
  <pre><code>import java.io.IOException;
  import java.net.URL;
  import java.net.URLConnection;
  
  import javax.swing.JEditorPane;
  import javax.swing.JFrame;
  import javax.swing.JScrollPane;
  
  import com.sun.org.apache.xml.internal.security.utils.Base64;
  
  public class webpageDisplay {
  
      /**
       * @param args
       * @throws IOException 
       */
      public static void main(String[] args) throws IOException {
          System.getProperties().put( "proxySet", "true" ); 
          System.getProperties().put( "proxyHost", "I given proxy host" ); 
          System.getProperties().put( "proxyPort", "85" ); 
          URL url=new URL("http://www.yahoo.com");
          URLConnection uc = url.openConnection ();
          String encoded = new String
                (Base64.encode(new String("user:pass").getBytes()));
          uc.setRequestProperty("Proxy-Authorization", "Basic " + encoded);
          uc.connect();
  
           //String url = "http://www.yahoo.com";
              JEditorPane editor = new JEditorPane(url);
              editor.setEditable(false);
              JScrollPane pane = new JScrollPane(editor);
              JFrame f = new JFrame("HTML Demo");
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.getContentPane().add(pane);
              f.setSize(800, 600);
              f.setVisible(true);
  
  
      }
  
  }
  </code></pre>
  
  <p>even though i provided proxy host and userid still iam getting erorr as below</p>
  
  <pre><code>Exception in thread "main" java.net.UnknownHostException: www.yahoo.com
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:196)
      at java.net.Socket.connect(Socket.java:530)
      at java.net.Socket.connect(Socket.java:480)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:169)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:406)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:541)
      at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:245)
      at sun.net.www.http.HttpClient.New(HttpClient.java:318)
      at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:790)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:738)
      at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:649)
      at webpageDisplay.main(webpageDisplay.java:26)
  </code></pre>
  
  <p>Can anyone suggest how to resolve the issue or how can i bypass the proxy</p>