title: SDN4 - Integration testing of neo4j server plugins
body: <p>I'm trying to test a <a href="http://neo4j.com/docs/stable/server-plugins.html" rel="nofollow">server plugin</a> from within a unit test. I've tried my best to set up the unit tests the same as <a href="https://github.com/luanne/flavorwocky" rel="nofollow">this project</a>.</p>
  
  <p>The issue I am having with my code is with the InProcessServer created by the PersistenceContext class. The InProcessServer starts on the first port available from 7474, and so for my tests, several InProcessServers are created, I think because new tests run before the port from the previous test is closed?</p>
  
  <p>In other words, during test execution, I will find in process servers open in my browser on localhost:7474, localhost:7475, localhost, 7476 and so on...</p>
  
  <p>Of course, this means when it comes to testing server plugins, during test execution I don't know which port I'm going to be testing against, or which database I'm going to hit. If I run my server plugin integration tests individually they run fine.</p>
  
  <p>My questions are:</p>
  
  <p>1) Have I understood all of this right in the first place? </p>
  
  <p>2) How can I test a server plugin as part of a larger integration test if I can't specify the port along with the server plugin uri in advance? Is there a clean way to find out the server port currently in use for a test at runtime? </p>