title: Receiving "javax.net.ssl.SSLException: java.lang.ArrayIndexOutOfBoundsException" while connecting to "https:" site
body: <p>I am trying to connect to a "https://" site which supports "TLSv1" protocol and the following cipher suites,</p>
  
  <p>TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x39)   DH 4096 bits<br>
  TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x33)   DH 4096 bits   </p>
  
  <p>using Apache's httpclient (Java platform - JDK 1.7)</p>
  
  <p>Its working fine in JDK1.8 (which has support for Cipher suites with DH parameters > 1024 bits)</p>
  
  <p>But its failing in JDK 1.7 with the following exception,</p>
  
  <pre><code>main, handling exception: java.lang.ArrayIndexOutOfBoundsException: 64
  %% Invalidated:  [Session-1, TLS_DHE_RSA_WITH_AES_128_CBC_SHA]
  main, SEND TLSv1 ALERT:  fatal, description = internal_error
  main, WRITE: TLSv1 Alert, length = 2
  [Raw write]: length = 7
  0000: 15 03 01 00 02 02 50                               ......P
  main, called closeSocket()
  main, IOException in getSession():  javax.net.ssl.SSLException: java.lang.ArrayIndexOutOfBoundsException: 64
  </code></pre>
  
  <p>As suggested in the workaround here, </p>
  
  <p><a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6521495" rel="nofollow">http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6521495</a>,
  I used tried using Bouncy Castle Provider but still getting the same exception.</p>
  
  <p>Any help would be great. Thanks.</p>