@Override
    protected void sendMessage(Connection cnx) throws Exception {
      HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
      byte[] secureBytes = null;
      hdos.writeLong(cnx.getConnectionID());
      if (this.securityProperties != null) {
        byte[] credentialBytes = null;
        // TODO this is not a valid way to create a member ID
        DistributedMember server =
            new InternalDistributedMember(
                cnx.getSocket().getInetAddress(), cnx.getSocket().getPort(), false);
        DistributedSystem sys = InternalDistributedSystem.getConnectedInstance();
        String authInitMethod =
            sys.getProperties().getProperty(DistributionConfig.SECURITY_CLIENT_AUTH_INIT_NAME);

        Properties credentials =
            HandShake.getCredentials(
                authInitMethod,
                this.securityProperties,
                server,
                false,
                (InternalLogWriter) sys.getLogWriter(),
                (InternalLogWriter) sys.getSecurityLogWriter());
        HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT);
        try {
          DataSerializer.writeProperties(credentials, heapdos);
          credentialBytes =
              ((ConnectionImpl) cnx).getHandShake().encryptBytes(heapdos.toByteArray());
        } finally {
          heapdos.close();
        }
        getMessage().addBytesPart(credentialBytes);
      }
      try {
        secureBytes = ((ConnectionImpl) cnx).getHandShake().encryptBytes(hdos.toByteArray());
      } finally {
        hdos.close();
      }
      getMessage().setSecurePart(secureBytes);
      getMessage().send(false);
    }