public static byte[] initializeAndGetDSIdentity(final DistributedSystem sys) {
    final byte[] client_side_identity;
    if (sys == null) {
      // DistributedSystem is required now before handshaking
      throw new IllegalStateException(
          "Attempting to handshake with CacheServer before creating DistributedSystem and Cache.");
    }
    systemMemberId = sys.getDistributedMember();
    try (HeapDataOutputStream hdos = new HeapDataOutputStream(256, KnownVersion.CURRENT)) {
      if (systemMemberId != null) {
        // update the durable id of the member identifier before serializing in case
        // a pool name has been established
        DurableClientAttributes attributes = systemMemberId.getDurableClientAttributes();
        if (attributes != null && attributes.getId().length() > 0) {
          ((InternalDistributedMember) systemMemberId).setDurableId(attributes.getId());
        }
      }
      DataSerializer.writeObject(systemMemberId, hdos);
      client_side_identity = hdos.toByteArray();
    } catch (IOException ioe) {
      throw new InternalGemFireException("Unable to serialize identity", ioe);
    }
    system = sys;
    return client_side_identity;
  }
method to obtain ClientProxyMembership for client side
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProxyMembershipID.java