How is it possible to link node to itself?

I’m evaluating GoJS library and got stuck with linking a node to itself. Let’s consider the following example as starting point.

Here we can connect nodes by drawing link from one node to another node and this works fine.But my case is the linking a node to another port of the same node such as in the following picture(red link):

How can I adjust this example to achieve my goal?

The default validation rules prevent users from drawing reflexive links. But you can change that by setting some properties. Please read GoJS Validation -- Northwoods Software and in particular GoJS Validation -- Northwoods Software.