I have used the below snippet of code and cannot get it working from
behind a proxy. I have Googled it and there are many examples of ways
to authenticate via the proxy and even though after connecting it says
connection status = true as soon as I issue the statement
("myService.setUserCredentials("[email protected]", "pwd");) I get an
error message as per below
Your help would be appreciated
Code snippet
import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.acl.*;
import com.google.gdata.data.calendar.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.*;
import java.io.*;
import sample.util.*;
public class CalendarTest {
public static void main(String[] args) {
CalendarService myService = new CalendarService("exampleCo-
exampleApp-1.0");
myService.setUserCredentials("[email protected]", "pa$$word");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/
default/allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl,
CalendarFeed.class);
System.out.println("Your calendars:");
System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}
}
}
Error Message
com.google.gdata.util.AuthenticationException: Error connecting with
login URI
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken
(GoogleAuthTokenFactory.java:479)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials
(GoogleAuthTokenFactory.java:336)
at com.google.gdata.client.GoogleService.setUserCredentials
(GoogleService.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials
(GoogleService.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials
(GoogleService.java:301)
at com.GoogleTest.LoginGoogle.main(LoginGoogle.java:69)
Caused by: java.net.ConnectException: Connection refused: connect
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.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect
(SSLSocketImpl.java:550)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect
(BaseSSLSocketImpl.java:141)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:
271)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:328)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient
(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect
(HttpURLConnection.java:778)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream
(HttpURLConnection.java:881)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream
(HttpsURLConnectionImpl.java:230)
at com.google.gdata.client.GoogleAuthTokenFactory.makePostRequest
(GoogleAuthTokenFactory.java:537)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken
(GoogleAuthTokenFactory.java:477)
... 5 more
java.net.ConnectException: Connection refused: connect
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.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient
(HttpURLConnection.java:837)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect
(HttpURLConnection.java:778)
at sun.net.www.protocol.http.HttpURLConnection.connect
(HttpURLConnection.java:703)
at com.google.gdata.client.http.HttpGDataRequest.execute
(HttpGDataRequest.java:487)
at com.google.gdata.client.http.GoogleGDataRequest.execute
(GoogleGDataRequest.java:515)
at com.google.gdata.client.Service.getFeed(Service.java:1034)
at com.google.gdata.client.Service.getFeed(Service.java:897)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:
631)
at com.google.gdata.client.Service.getFeed(Service.java:916)
at com.GoogleTest.LoginGoogle.main(LoginGoogle.java:79)
--
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en.