In lib/puppet/defaults.rb, create "serverport" setting (to replace "masterport")
It should be possible to specify either on the command line, puppet.conf or in code.
Merged to master in https://github.com/puppetlabs/puppet/commit/a2230bc8f3dab86a6b72c67a9373eab06f01cccd
The original change was reverted and new changes merged to master in https://github.com/puppetlabs/puppet/commit/1d9d86f933453f360f9253259ac037948ae93e1a