您好,我在尝试使用 SSLFactory 连接到 Java 中的 SSL 时收到此错误
堆栈跟踪:
javax.net.ssl.SSLHandshakeException: invalid SSL record content type
at com.ibm.j9.jsse.SSLSocketImpl.completeHandshake(Unknown Source)
at com.ibm.j9.jsse.SSLSocketImpl.getInputStream(Unknown Source)
这是握手期间的代码错误:
_socket = SocketFactory.getSslSocket( _socket, //Socket created before this call
_address, //host that supports SSL
_port.intValue() );
SSLSocket tempSocket = (SSLSocket)_socket;
String[] supportedCipherSuites = tempSocket.getSupportedCipherSuites();
System.out.println( "Supported Cipher Suites:" );
for( int i = 0; i < supportedCipherSuites.length; i++ )
{
System.out.println( supportedCipherSuites[i] );
}
tempSocket.setUseClientMode( true );
tempSocket.startHandshake();