Hei,
Yritän tässä koodailla javaa ja saada gmaililta haettua lukemattomatt postit listaan proxyn läpi.
Käytän seuraavaa luokkaa:
http://paste.ubuntu.com/550143/Kuten logista näkyy, homma kaatuu "Failed getting unread messages":
[2011-01-04 11:09:38,307] [main] DEBUG httpclient.wire.header - >> "CONNECT imap.gmail.com:993 HTTP/1.1"
[2011-01-04 11:09:38,308] [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Adding Host request header
[2011-01-04 11:09:38,308] [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
[2011-01-04 11:09:38,308] [main] DEBUG httpclient.wire.header - >> "Host: imap.gmail.com:993[\r][\n]"
[2011-01-04 11:09:38,308] [main] DEBUG httpclient.wire.header - >> "Proxy-Connection: Keep-Alive[\r][\n]"
[2011-01-04 11:09:38,308] [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
[2011-01-04 11:09:38,328] [main] DEBUG httpclient.wire.header - << "HTTP/1.1 200 Connection established[\r][\n]"
[2011-01-04 11:09:38,328] [main] DEBUG httpclient.wire.header - << "HTTP/1.1 200 Connection established[\r][\n]"
[2011-01-04 11:09:38,329] [main] DEBUG httpclient.wire.header - << "[\r][\n]"
[2011-01-04 11:09:38,338] [main] INFO org.apache.commons.httpclient.HttpMethodBase - Response content length is not known
[2011-01-04 11:09:38,338] [main] DEBUG org.apache.commons.httpclient.HttpMethodBase - Force-close connection: true
[2011-01-04 11:09:38,339] [main] DEBUG org.apache.commons.httpclient.ConnectMethod - CONNECT status code 200
[2011-01-04 11:09:38,339] [main] DEBUG com.googlecode.gmail4j.http.HttpProxyAwareSslSocketFactory - Connected, returning socket
Exception in thread "main" com.googlecode.gmail4j.GmailException: Failed getting unread messages
at com.googlecode.gmail4j.javamail.ImapGmailClient.getUnreadMessages(ImapGmailClient.java:78)
at Main.main(Main.java:49)
Caused by: com.googlecode.gmail4j.GmailException: Failed opening Gmail IMAP store
at com.googlecode.gmail4j.javamail.ImapGmailConnection.openGmailStore(ImapGmailConnection.java:227)
at com.googlecode.gmail4j.javamail.ImapGmailClient.openGmailStore(ImapGmailClient.java:90)
at com.googlecode.gmail4j.javamail.ImapGmailClient.getUnreadMessages(ImapGmailClient.java:69)
... 1 more
Caused by: javax.mail.MessagingException: Connection timed out;
nested exception is:
java.net.ConnectException: Connection timed out
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:618)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at com.googlecode.gmail4j.javamail.ImapGmailConnection.openGmailStore(ImapGmailConnection.java:223)
... 3 more
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:546)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:579)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:109)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:104)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:585)
... 6 more
Java Result: 1
BUILD SUCCESSFUL (total time: 21 seconds)
Kokemuksia / vinkkejä aiheesta otetaan mieluusti vastaan.
-larpa