當前位置: 首頁>>代碼示例>>Java>>正文


Java SSLSocket.setEnableSessionCreation方法代碼示例

本文整理匯總了Java中javax.net.ssl.SSLSocket.setEnableSessionCreation方法的典型用法代碼示例。如果您正苦於以下問題:Java SSLSocket.setEnableSessionCreation方法的具體用法?Java SSLSocket.setEnableSessionCreation怎麽用?Java SSLSocket.setEnableSessionCreation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.net.ssl.SSLSocket的用法示例。


在下文中一共展示了SSLSocket.setEnableSessionCreation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sslNegotiation

import javax.net.ssl.SSLSocket; //導入方法依賴的package包/類
/**
 * SSL/TLS negotiation. Acquires an SSL socket of a control
 * connection and carries out handshake processing.
 * @throws java.io.IOException If server negotiation fails
 */
protected void sslNegotiation() throws IOException {
    plainSocket = _socket_;
    initSslContext();

    SSLSocketFactory ssf = context.getSocketFactory();
    String ip = _socket_.getInetAddress().getHostAddress();
    int port = _socket_.getPort();
    SSLSocket socket =
        (SSLSocket) ssf.createSocket(_socket_, ip, port, false);
    socket.setEnableSessionCreation(isCreation);
    socket.setUseClientMode(isClientMode);
    // server mode
    if (!isClientMode) {
        socket.setNeedClientAuth(isNeedClientAuth);
        socket.setWantClientAuth(isWantClientAuth);
    }

    if (protocols != null) {
        socket.setEnabledProtocols(protocols);
    }
    if (suites != null) {
        socket.setEnabledCipherSuites(suites);
    }
    socket.startHandshake();

    _socket_ = socket;
    _controlInput_ = new BufferedReader(new InputStreamReader(
            socket .getInputStream(), getControlEncoding()));
    _controlOutput_ = new BufferedWriter(new OutputStreamWriter(
            socket.getOutputStream(), getControlEncoding()));
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:37,代碼來源:FTPSClient.java

示例2: _openDataConnection_

import javax.net.ssl.SSLSocket; //導入方法依賴的package包/類
/**
 * Returns a socket of the data connection.
 * Wrapped as an {@link javax.net.ssl.SSLSocket}, which carries out handshake processing.
 * @param command The textual representation of the FTP command to send.
 * @param arg The arguments to the FTP command.
 * If this parameter is set to null, then the command is sent with
 * no arguments.
 * @return corresponding to the established data connection.
 * Null is returned if an FTP protocol error is reported at any point
 * during the establishment and initialization of the connection.
 * @throws java.io.IOException If there is any problem with the connection.
 * @see org.apache.commons.net.ftp.FTPClient#_openDataConnection_(int, String)
 * @since 3.2
 */
@Override
protected Socket _openDataConnection_(String command, String arg)
        throws IOException {
    Socket socket = super._openDataConnection_(command, arg);
    _prepareDataSocket_(socket);
    if (socket instanceof SSLSocket) {
        SSLSocket sslSocket = (SSLSocket)socket;

        sslSocket.setUseClientMode(isClientMode);
        sslSocket.setEnableSessionCreation(isCreation);

        // server mode
        if (!isClientMode) {
            sslSocket.setNeedClientAuth(isNeedClientAuth);
            sslSocket.setWantClientAuth(isWantClientAuth);
        }
        if (suites != null) {
            sslSocket.setEnabledCipherSuites(suites);
        }
        if (protocols != null) {
            sslSocket.setEnabledProtocols(protocols);
        }
        sslSocket.startHandshake();
    }

    return socket;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:42,代碼來源:FTPSClient.java

示例3: sslNegotiation

import javax.net.ssl.SSLSocket; //導入方法依賴的package包/類
@Override
protected void sslNegotiation() throws IOException {
    if(protocol.isSecure()) {
        final SSLSocket socket = (SSLSocket) sslSocketFactory.createSocket(_socket_,
                _socket_.getInetAddress().getHostAddress(), _socket_.getPort(), false);
        socket.setEnableSessionCreation(true);
        socket.setUseClientMode(true);
        socket.startHandshake();
        _socket_ = socket;
        _controlInput_ = new BufferedReader(new InputStreamReader(
                socket.getInputStream(), getControlEncoding()));
        _controlOutput_ = new BufferedWriter(new OutputStreamWriter(
                socket.getOutputStream(), getControlEncoding()));
    }
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:16,代碼來源:FTPClient.java


注:本文中的javax.net.ssl.SSLSocket.setEnableSessionCreation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。