etcdserver/etcdhttp: split out peers and add tests

in this case, ts will be closed when we return from the function stack. so we will leave a bunch of httptest server running when inside the for loop. 

@unihorn @eyakubovich must agree that defer in a for loop is dangerous. A common mistake is the wrong assumption that `defer will be executed at the end of each loop`.