How to spawn a cowboy server in a test?

Are you familiar with bypass? Use it directly if you can, but if you have some unique requirements that preclude that, then its source contains techniques you could customize.