Custom Nodes: How to validate a link?
I'm not sure this is what you're looking for.

In Sverchok we add a property to the socket class, called 'other', which returns the socket instance of the other socket, and even iterates back through "ReRoute" nodes. 

@property
def other(self):
    return get_other_socket(self)


This lets us do a simple test when appropriate.

if not socket.is_output:
    if not (socket.bl_idname == socket.other.bl_idname):
        ... # handle the mismatch in socket types


You figure the logic out for input sockets vs output sockets. Some node systems (Sverchok included) don't allow a node to accept multiple links on an input socket -- By design.

modified from sverchok/data_structure.py

def get_other_socket(socket):
    """
    Get next real upstream socket.
    Will return None if there isn't a another socket connect
    so no need to check socket.links
    """
    if not socket.is_linked:
        return None
    if not socket.is_output:
        other = socket.links[0].from_socket
    else:
        other = socket.links[0].to_socket

    if other.node.bl_idname == 'NodeReroute':
        if not socket.is_output:
            return get_other_socket(other.node.inputs[0])
        else:
            return get_other_socket(other.node.outputs[0])
    else:
        return other