public static byte[] toByteArray(SyncReplicationState state, SyncReplicationState newState) {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
      out.write(ProtobufMagic.PB_MAGIC);
      ReplicationPeerConfigUtil.toSyncReplicationState(state).writeDelimitedTo(out);
      ReplicationPeerConfigUtil.toSyncReplicationState(newState).writeDelimitedTo(out);
    } catch (IOException e) {
      // should not happen, all in memory operations
      throw new AssertionError(e);
    }
    return out.toByteArray();
  }
Used by synchronous replication. Indicate the state of the current cluster in a synchronous
replication peer. The state may be one of {@link SyncReplicationState#ACTIVE},
{@link SyncReplicationState#DOWNGRADE_ACTIVE} or {@link SyncReplicationState#STANDBY}.
<p>
For asynchronous replication, the state is {@link SyncReplicationState#NONE}.
hbase-client/src/main/java/org/apache/hadoop/hbase/replication/SyncReplicationState.java