code: private static void trySetFakeRemoteHost(Socket socket) {
          try {
              final Method setHostMethod = socket.getClass().getMethod("setHost", String.class);
              String fakeHostName = "greenmailHost" + new BigInteger(130, new Random()).toString(32);
              setHostMethod.invoke(socket, fakeHostName);
          } catch (NoSuchMethodException e) {
              log.debug("Could not set fake remote host. SSL connection setup may be slow.");
          } catch (InvocationTargetException e) {
              log.debug("Could not set fake remote host. SSL connection setup may be slow.");
          } catch (IllegalAccessException e) {
              log.debug("Could not set fake remote host. SSL connection setup may be slow.");
          }
      }
docs: We set the host name of the remote machine because otherwise the SSL implementation is going to try
  to try to do a reverse lookup to find out the host name for the host which is really slow.
  Of course we don't know the host name of the remote machine so we just set a fake host name that is unique.
  <p/>
  This forces the SSL stack to do key negotiation every time we connect to a host but is still much faster
  than doing the reverse hostname lookup. The negotiation is caused by the fact that the SSL stack remembers
  a trust relationship with a host. If we connect to the same host twice this relationship is reused. Since
  we set the host name to a random value this reuse never happens.
  
  @param socket Socket to set host on