/** * Get the peer certificate list by initiating a new handshake. * @param key {@link SelectionKey} * @param needClientAuth * @return Object[] An array of X509Certificate. * @throws java.io.IOException */ public static Object[] doPeerCertificateChain(SelectionKey key, boolean needClientAuth) throws IOException { final WorkerThread workerThread = (WorkerThread)Thread.currentThread(); ByteBuffer byteBuffer = workerThread.getByteBuffer(); ByteBuffer inputBB = workerThread.getInputBB(); ByteBuffer outputBB = workerThread.getOutputBB(); SSLEngine sslEngine = workerThread.getSSLEngine(); return SSLUtils.doPeerCertificateChain((SocketChannel) key.channel(), byteBuffer, inputBB, outputBB, sslEngine, needClientAuth, InputReader.getDefaultReadTimeout()); }