rishabchirania / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

how to set setHttpReferrer please help me #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i tried like

System.setProperty("http.proxyHost", "192.168.12.216");
          System.setProperty("http.proxyPort", "3126");
           System.setProperty("http.proxyUser", "");
          System.setProperty("http.proxyPassword", "");
Translate.setHttpReferrer("localhost");

but i am getting error like this 

Exception in thread "main" java.lang.Exception: [google-api-translate-java] 
Error retrieving translation.
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:123)
        at com.google.api.translate.Translate.execute(Translate.java:69)
        at Main.main(Main.java:11)
Caused by: java.net.SocketException: Network is unreachable
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:382)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:509)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
        at sun.net.www.http.HttpClient.New(HttpClient.java:304)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:820)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:779)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:690)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:107)
        ... 2 more

how to solve

Original issue reported on code.google.com by GOW...@gmail.com on 10 Feb 2011 at 5:29

GoogleCodeExporter commented 9 years ago
I _think_ that looks like an issue connecting to your proxy, rather than the 
translation service complaining.

Original comment by rich.mid...@gmail.com on 12 Feb 2011 at 10:25

GoogleCodeExporter commented 9 years ago
I _think_ that looks like an issue connecting to your proxy, rather than the 
translation service complaining.

Original comment by rich.mid...@gmail.com on 12 Feb 2011 at 10:25