sslSocket = x509Util.createSSLSocket(prependableSocket, litmus); } catch (X509Exception e) { throw new IOException("failed to create SSL context", e);
clientSocket = x509Util.createSSLSocket(); clientSocket.connect(localServerAddress); } else {
@Test(timeout = 5000) public void testCreateSSLContextWithCustomCipherSuites() throws Exception { setCustomCipherSuites(); SSLSocket sslSocket = x509Util.createSSLSocket(); Assert.assertArrayEquals(customCipherSuites, sslSocket.getEnabledCipherSuites()); }
@Test(timeout = 5000) public void testCreateSSLSocket() throws Exception { setCustomCipherSuites(); SSLSocket sslSocket = x509Util.createSSLSocket(); Assert.assertArrayEquals(customCipherSuites, sslSocket.getEnabledCipherSuites()); }
clientSocket = x509Util.createSSLSocket(); clientSocket.connect(localServerAddress); clientSocket.getOutputStream().write(1);
private SSLSocket connectWithSSL() throws IOException, X509Exception, InterruptedException { SSLSocket sslSocket = null; int retries = 0; while (retries < MAX_RETRIES) { try { sslSocket = x509Util.createSSLSocket(); sslSocket.addHandshakeCompletedListener(new HandshakeCompletedListener() { @Override public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) { synchronized (handshakeCompletedLock) { handshakeCompleted = true; handshakeCompletedLock.notifyAll(); } } }); sslSocket.setSoTimeout(TIMEOUT); sslSocket.connect(localServerAddress, TIMEOUT); break; } catch (ConnectException connectException) { connectException.printStackTrace(); forceClose(sslSocket); sslSocket = null; Thread.sleep(TIMEOUT); } retries++; } Assert.assertNotNull("Failed to connect to server with SSL", sslSocket); return sslSocket; }