title: How to avoid Diffie-Hellman for SSL connections with Java/Netty?
body: <p>I am using Netty as backend in a Java-based Usenet client. The library is working fine, however, in some circumstances I can't connect to a remote server via SSL, because of exactly this error:</p>
  
  <p><a href="https://stackoverflow.com/questions/6851461/java-why-does-ssl-handshake-give-could-not-generate-dh-keypair-exception">Java: Why does SSL handshake give &#39;Could not generate DH keypair&#39; exception?</a></p>
  
  <p>Unfortunately, it seems that for whatever reason this Java error still has not been fixed yet. And since the remote server is not under my control, I need a workaround here. One such "solution", according to the link above, is to avoid DH during SSL handshake at all (not very pretty, but maybe better than nothing). </p>
  
  <p>However, I am no SSL expert, so I am not really sure how I can implement that within Netty; or better: within my solution that is based on Netty. By now I am creating connections as this:</p>
  
  <pre class="lang-java prettyprint-override"><code>// configure the Netty client
  ClientBootstrap bootstrap = new ClientBootstrap(clSockChannelFactory);
  
  // configure the pipeline factory
  bootstrap.setPipelineFactory(channelPipelineFactory);
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("keepAlive", true);
  bootstrap.setOption("child.receiveBufferSizePredictorFactory", 
            new AdaptiveReceiveBufferSizePredictorFactory());
  
  // start the connection attempt
  InetSocketAddress isa = new InetSocketAddress(serverAddress, port);
  ChannelFuture future = bootstrap.connect(isa);
  ...
  channel = future.getChannel();
  ...
  </code></pre>
  
  <p>Ok, that's fine, but where can I disable cipher suites before I connect the SSL socket, as desribed in the thread above?</p>
  
  <p>Thanks in advance for all your help!</p>
  
  <p>Kind regards, Matthias</p>
  
  <p>PS: By the way, any ideas why this problem has not been addressed in Java yet?</p>