I would create my own constraint from Point2PointConstraint (ball and socket).
Line 98 is what needs to be changed. Essentially, you should create a new kind of constraint that knows what distance you want between the two objects. Instead of trying to match pivotAInW and pivotBInW together in world space (depth == 0), the depth variable should be zero when the length of the vector joining pivotAInW and pivotBInW is equal to distance. You may want to safeguard your code against the special case when both pivots are at the same point in space and force a direction in which to apply an impulse, say about the x axis.