title: SSL Handshake failures with client and server
body: <p>So I'm building a client on Python and a server on Java to communicate and transfer files and strings. I'm thinking that the first thing I would have to do (besides connect the Server and Client) is complete the SSL Handshake. The following is my Python client code and Java server code that I have implemented:</p>
  
  <p>Python Client Code</p>
  
  <pre><code>import socket
  import ssl
  import struct
  import io
  import threading
  import optparse
  import os
  import sys
  
  HOST = "localhost"
  PORT = 777
  ADDR = (HOST,PORT)
  
  
  
  
  def sock_connection():
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
      time.sleep(1)
      ssl_sock = ssl.wrap_socket(sock)
      try:
          time.sleep(1)
          ssl_sock.connect(ADDR)
          print('CONNECTED!')
      except socket.error as e:
          print('ERROR', e)
          exit(1)
      return ssl_sock
  
  def main():
      sock_connection()
  
  main()
  </code></pre>
  
  <p>Java Server code:</p>
  
  <pre><code>import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map.Entry;
  import java.io.BufferedReader;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  
  import javax.net.ssl.SSLServerSocket;
  import javax.net.ssl.SSLServerSocketFactory;
  import javax.net.ssl.SSLSocket;
  
  
  
    public 
    class Server {
      private static final int PORT = 777;
  
     public
              static
      void
              main(String[] arstring) {
          try {
              SSLServerSocketFactory sslserversocketfactory =
                      (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
              SSLServerSocket sslserversocket =
                      (SSLServerSocket) sslserversocketfactory.createServerSocket(PORT);
              SSLSocket sslsocket = (SSLSocket) sslserversocket.accept();
  
              InputStream inputstream = sslsocket.getInputStream();
              InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
              BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
  
              String string = null;
              while ((string = bufferedreader.readLine()) != null) {
                  System.out.println(string);
                  System.out.flush();
              }
          } catch (Exception exception) {
              exception.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>I normally run the Server first, which runs fine, then i run the client and i receive the following error in the server terminal:</p>
  
  <p>javax.net.ssl.SSLHandshakeException: no cipher suits in common</p>
  
  <p>And the following in python:</p>
  
  <p>ERROR [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)</p>
  
  <p>Any and all help would be greatly appreciated.</p>
  
  <p>Thanks</p>