driver-legacy/src/main/com/mongodb/ReplicaSetStatus.java
public boolean isMaster(final ServerAddress serverAddress) {
        ServerAddress masterServerAddress = getMaster();
        return masterServerAddress != null && masterServerAddress.equals(serverAddress);
    }
public boolean isMaster(final ServerAddress serverAddress) {
        ServerAddress masterServerAddress = getMaster();
        return masterServerAddress != null && masterServerAddress.equals(serverAddress);
    }
Checks to see if a given server is the primary server in this replica set.

@param serverAddress the server to compare
@return true if the given ServerAddress is the current Master/Primary