当前位置: 首页>>代码示例>>Java>>正文


Java HandshakeCompletedEvent类代码示例

本文整理汇总了Java中javax.net.ssl.HandshakeCompletedEvent的典型用法代码示例。如果您正苦于以下问题:Java HandshakeCompletedEvent类的具体用法?Java HandshakeCompletedEvent怎么用?Java HandshakeCompletedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HandshakeCompletedEvent类属于javax.net.ssl包,在下文中一共展示了HandshakeCompletedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handshakeCompleted

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
public void handshakeCompleted(HandshakeCompletedEvent evt) {

        SSLSession session;
        String     sessionId;
        SSLSocket  socket;

        if (Error.TRACESYSTEMOUT) {
            socket  = evt.getSocket();
            session = evt.getSession();

            Error.printSystemOut("SSL handshake completed:");
            Error.printSystemOut(
                "------------------------------------------------");
            Error.printSystemOut("socket:      : " + socket);
            Error.printSystemOut("cipher suite : " + session.getCipherSuite());

            sessionId = StringConverter.byteArrayToHexString(session.getId());

            Error.printSystemOut("session id   : " + sessionId);
            Error.printSystemOut(
                "------------------------------------------------");
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:24,代码来源:HsqlSocketFactorySecure.java

示例2: handshakeCompleted

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
public void handshakeCompleted(HandshakeCompletedEvent evt) {

        SSLSession session;
        String     sessionId;
        SSLSocket  socket;

        if (Trace.TRACE) {
            socket  = evt.getSocket();
            session = evt.getSession();

            Trace.printSystemOut("SSL handshake completed:");
            Trace.printSystemOut(
                "------------------------------------------------");
            Trace.printSystemOut("socket:      : " + socket);
            Trace.printSystemOut("cipher suite : "
                                 + session.getCipherSuite());

            sessionId = StringConverter.byteToHex(session.getId());

            Trace.printSystemOut("session id   : " + sessionId);
            Trace.printSystemOut(
                "------------------------------------------------");
        }
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:HsqlSocketFactorySecure.java

示例3: notifyHandshakeCompletedListeners

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
final void notifyHandshakeCompletedListeners() {
    if (listeners != null && !listeners.isEmpty()) {
        // notify the listeners
        HandshakeCompletedEvent event = new HandshakeCompletedEvent(this, getActiveSession());
        for (HandshakeCompletedListener listener : listeners) {
            try {
                listener.handshakeCompleted(event);
            } catch (RuntimeException e) {
                // The RI runs the handlers in a separate thread,
                // which we do not. But we try to preserve their
                // behavior of logging a problem and not killing
                // the handshaking thread just because a listener
                // has a problem.
                Thread thread = Thread.currentThread();
                thread.getUncaughtExceptionHandler().uncaughtException(thread, e);
            }
        }
    }
}
 
开发者ID:google,项目名称:conscrypt,代码行数:20,代码来源:ConscryptSocketBase.java

示例4: handshakeCompleted

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
@Override
public void handshakeCompleted(HandshakeCompletedEvent event) {

	SSLSession session = event.getSession();
	sslConnectionInfos.setPeerHost(session.getPeerHost());
	sslConnectionInfos.setPeerPort(session.getPeerPort());
	sslConnectionInfos.setProtocol(session.getProtocol());
	sslConnectionInfos.setCipherSuite(session.getCipherSuite());

	Certificate[] locChain = session.getLocalCertificates();
	if (locChain != null) {
		X509Certificate[] clientCertificates = Arrays.copyOf(locChain, locChain.length, X509Certificate[].class);
		sslConnectionInfos.setClientCertificates(clientCertificates);
	}

	try {
		Certificate[] chain = session.getPeerCertificates();
		if (chain != null) {
			X509Certificate[] serverCertificates = Arrays.copyOf(chain, chain.length, X509Certificate[].class);
			sslConnectionInfos.setServerCertificates(serverCertificates);
		}
	} catch (SSLPeerUnverifiedException e) {
		// do nothing
	}
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:26,代码来源:RetrieveSslInfosHandshakeListener.java

示例5: connect

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
    Date start = new Date();
    socket.connect(endpoint, timeout);
    Date end = new Date();
    RequestInfo.get().connect(start, end);
    handshakeStart = new Date();
    startHandshake();
    this.addHandshakeCompletedListener(new HandshakeCompletedListener() {
        @Override
        public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) {
            if (handshakeStart != null) {
                RequestInfo.get().ssl(handshakeStart, new Date());
            }
        }
    });
}
 
开发者ID:epam,项目名称:Wilma,代码行数:18,代码来源:SimulatedSSLSocket.java

示例6: notifyHandshakeCompletedListeners

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
private void notifyHandshakeCompletedListeners() {
    if (listeners != null && !listeners.isEmpty()) {
        // notify the listeners
        HandshakeCompletedEvent event =
            new HandshakeCompletedEvent(this, sslSession);
        for (HandshakeCompletedListener listener : listeners) {
            try {
                listener.handshakeCompleted(event);
            } catch (RuntimeException e) {
                // The RI runs the handlers in a separate thread,
                // which we do not. But we try to preserve their
                // behavior of logging a problem and not killing
                // the handshaking thread just because a listener
                // has a problem.
                Thread thread = Thread.currentThread();
                thread.getUncaughtExceptionHandler().uncaughtException(thread, e);
            }
        }
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:OpenSSLSocketImpl.java

示例7: test_getCipherSuite

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getCipherSuite()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getCipherSuite",
    args = {}
)
public final void test_getCipherSuite() throws IOException {
    mySSLSession session = new mySSLSession("localhost", 1080, null);
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
    try {
        assertEquals("SuiteName", event.getCipherSuite());
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:HandshakeCompletedEventTest.java

示例8: test_getLocalCertificates

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getLocalCertificates()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getLocalCertificates",
    args = {}
)
public final void test_getLocalCertificates() throws IOException {
    mySSLSession session = new mySSLSession("localhost", 1080, null);
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
    try {
        assertNull(event.getLocalCertificates());
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:HandshakeCompletedEventTest.java

示例9: test_getLocalPrincipal

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getLocalPrincipal()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getLocalPrincipal",
    args = {}
)
public final void test_getLocalPrincipal() throws IOException {
    mySSLSession session = new mySSLSession("localhost", 1080, null);
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
    try {
        assertNull(event.getLocalPrincipal());
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:HandshakeCompletedEventTest.java

示例10: test_getPeerPrincipal

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getPeerPrincipal()
 */
@TestTargetNew(
    level = TestLevel.SUFFICIENT,
    notes = "",
    method = "getPeerPrincipal",
    args = {}
)
public final void test_getPeerPrincipal() throws IOException {
    mySSLSession session = new mySSLSession("localhost", 1080, null);
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
    try {
        assertNull(event.getPeerPrincipal());
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:HandshakeCompletedEventTest.java

示例11: test_getSession

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getSession()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getSession",
    args = {}
)
public final void test_getSession() throws IOException {
    mySSLSession session = new mySSLSession("localhost", 1080, null);
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
    try {
        SSLSession ss = event.getSession();
        assertNotNull(ss);
        assertEquals(session, ss);
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:HandshakeCompletedEventTest.java

示例12: test_getSocket

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
/**
 * @throws IOException
 * @tests javax.net.ssl.HandshakeCompletedEvent#getSocket()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getSocket",
    args = {}
)
public final void test_getSocket() throws IOException {
    SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, null);
    try {
        SSLSocket ss = event.getSocket();
        assertNotNull(ss);
        assertEquals(socket, ss);
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:HandshakeCompletedEventTest.java

示例13: handshakeCompleted

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
public void handshakeCompleted(HandshakeCompletedEvent evt) {

        SSLSession session;
        String     sessionId;
        SSLSocket  socket;

        if (Error.TRACESYSTEMOUT) {
            socket  = evt.getSocket();
            session = evt.getSession();

            Error.printSystemOut("SSL handshake completed:");
            Error.printSystemOut(
                "------------------------------------------------");
            Error.printSystemOut("socket:      : " + socket);
            Error.printSystemOut("cipher suite : "
                                 + session.getCipherSuite());

            sessionId = StringConverter.byteArrayToHexString(session.getId());

            Error.printSystemOut("session id   : " + sessionId);
            Error.printSystemOut(
                "------------------------------------------------");
        }
    }
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:25,代码来源:HsqlSocketFactorySecure.java

示例14: testGetLocalCertificates

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
public final void testGetLocalCertificates() {
	if (noFreePort || noSocket) {
        return;
    }
	SSLSession ses = new MySSLSession();
    HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);

    Certificate[] certs = event.getLocalCertificates();
    Certificate[] ses_certs = ses.getLocalCertificates();
    if (certs == null && ses_certs == null) {
        return;
    }
    if (certs == null || ses_certs == null) {
        fail("incorrect LocalCertificates");
    }
    for (int i = 0; i < certs.length; i++) {
        if (certs[i] != ses_certs[i]) {
            fail("incorrect LocalCertificates");
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:HandshakeCompletedEventTest.java

示例15: testGetCipherSuite

import javax.net.ssl.HandshakeCompletedEvent; //导入依赖的package包/类
public final void testGetCipherSuite() {
    if (noFreePort || noSocket) {
        return;
    }
    SSLSession ses = new MySSLSession();

    HandshakeCompletedEvent event = new HandshakeCompletedEvent(soc, ses);
    String name = event.getCipherSuite();
    String name_ses = ses.getCipherSuite();
    if (name == null && name_ses != null) {
        fail("incorrect null CipherCuite");
    }
    if (!name.equals(name_ses)) {
        fail("incorrect CipherCuite");
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:HandshakeCompletedEventTest.java


注:本文中的javax.net.ssl.HandshakeCompletedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。