Unit tests and fixes for EndpointDef.