当前位置: 代码迷 >> J2ME >> javax.microedition.io.ConnectionNotFoundException:   TCP
  详细解决方案

javax.microedition.io.ConnectionNotFoundException:   TCP

热度:6708   发布时间:2013-02-25 21:35:18.0
HttpsConnection连接问题
我是公司内网,通过公司的服务器代理上网的,我想试试
HttpsConnection,代码如下
HttpsConnection   sc   =   (HttpsConnection)   Connector
.open( "https://sourceforge.net/ ");
//   SecureConnection   sc   =   (SecureConnection)   Connector
//   .open( "https://sourceforge.net/ ");
SecurityInfo   info   =   sc.getSecurityInfo();
System.out.print( "Protocol "   +   info.getProtocolName());
System.out.print( "cert "   +   info.getServerCertificate());
System.out.print( "Cipher "   +   info.getCipherSuite());
System.out.print( "Protocol "   +   info.getProtocolVersion());

报错:
javax.microedition.io.ConnectionNotFoundException:   TCP   open
at   com.sun.midp.io.j2me.socket.Protocol.connect(+99)
at   com.sun.midp.io.ConnectionBaseAdapter.openPrim(+52)
at   com.sun.midp.io.j2me.socket.Protocol.openPrim(+108)
at   com.sun.midp.io.ConnectionBaseAdapter.openPrim(+14)
at   com.sun.midp.io.ConnectionBaseAdapter.openPrim(+8)
at   com.sun.midp.io.j2me.https.Protocol.connect(+167)
at   com.sun.midp.io.j2me.http.Protocol.streamConnect(+57)
at   com.sun.midp.io.j2me.http.Protocol.startRequest(+12)
at   com.sun.midp.io.j2me.http.Protocol.sendRequest(+38)
at   com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
at   com.sun.midp.io.j2me.https.Protocol.getSecurityInfo(+8)
at   com.mypack.Test2.startApp(+15)
at   javax.microedition.midlet.MIDletProxy.startApp(+7)
at   com.sun.midp.midlet.Scheduler.schedule(+270)
at   com.sun.midp.main.Main.runLocalClass(+28)
at   com.sun.midp.main.Main.main(+80)
IE打开https://sourceforge.net/没问题,
是不是因为我是内网模拟器连不过去啊?
有什么办法没?
谢谢

------解决方案--------------------------------------------------------
我运行你的代码
结果如下:
ProtocolSSLcert[Type: X.509v3
Serial number: 5B:E2:30:59:83:E3:06:A2:7A:4D:B5:F7:CD:BC:98:C5
Subject: 2B:06:01:04:01:82:37:3C:02:01:03=US;2B:06:01:04:01:82:37:3C:02:01:02=Delaware;2B:06:01:04:01:82:37:3C:02:01:01=Wilmington;C=US;ST=California;L=Fremont;O=VA Software Corporation;OU=OSTG;OU=Terms of use at www.verisign.com/rpa (c)05;CN=sourceforge.net;55:04:05=3087994
Issuer: C=US;O=VeriSign, Inc.;OU=VeriSign Trust Network;OU=Terms of use at https://www.verisign.com/rpa (c)06;CN=VeriSign Class 3 Extended Validation SSL SGC CA
Valid from 5/29/2007 0:0:0 GMT until 5/28/2008 23:59:59 GMT
Signature Algorithm: SHA1withRSA
KeyUsage: digitalSignature keyEncipherment
BasicConstraints: not a CA (pathLengthConstraint absent)]CipherTLS_RSA_WITH_RC4_128_SHAProtocol3.0
  相关解决方案