Add serverconnection scripthook
diff --git a/.travis.yml b/.travis.yml
index 5f4a36020a..c108431995 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,13 @@ python:
   - "2.7"
 # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
 install: 
+  - "pip install coveralls --use-mirrors"
+  - "pip install nose-cov --use-mirrors"
   - "pip install -r requirements.txt --use-mirrors"
   - "pip install --upgrade git+https://github.com/mitmproxy/netlib.git"
   - "pip install --upgrade git+https://github.com/mitmproxy/pathod.git"
 # command to run tests, e.g. python setup.py test
-script: nosetests
\ No newline at end of file
+script: 
+  - "nosetests --with-cov --cov-report term-missing"
+after_success: 
+  - coveralls
\ No newline at end of file
diff --git a/README.mkd b/README.mkd
index 8f564d7ff5..35b41413d4 100644
--- a/README.mkd
+++ b/README.mkd
@@ -1,3 +1,5 @@
+[![Build Status](https://travis-ci.org/mitmproxy/mitmproxy.png)](https://travis-ci.org/mitmproxy/mitmproxy) [![Coverage Status](https://coveralls.io/repos/mitmproxy/mitmproxy/badge.png)](https://coveralls.io/r/mitmproxy/mitmproxy)
+
 __mitmproxy__ is an interactive, SSL-capable man-in-the-middle proxy for HTTP
 with a console interface.
 
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 2404281263..40b7e535b5 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -1580,6 +1580,13 @@ def handle_clientdisconnect(self, r):
         self.run_script_hook("clientdisconnect", r)
         r.reply()
 
+    def handle_serverconnection(self, sc):
+        # To unify the mitmproxy script API, we call the script hook "serverconnect" rather than "serverconnection".
+        # As things are handled differently in libmproxy (ClientConnect + ClientDisconnect vs ServerConnection class),
+        # there is no "serverdisonnect" event at the moment.
+        self.run_script_hook("serverconnect", sc)
+        sc.reply()
+
     def handle_error(self, r):
         f = self.state.add_error(r)
         if f:
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 75a5419201..94f358bcb6 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -158,6 +158,7 @@ def get_server_connection(self, cc, scheme, host, port, sni):
         if not self.server_conn:
             try:
                 self.server_conn = ServerConnection(self.config, scheme, host, port, sni)
+                self.channel.ask(self.server_conn)
                 self.server_conn.connect()
             except tcp.NetLibError, v:
                 raise ProxyError(502, v)
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000..3ecd8ed4e4
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,15 @@
+Flask>=0.9
+Jinja2>=2.7
+MarkupSafe>=0.18
+PIL>=1.1.7
+Werkzeug>=0.8.3
+lxml>=3.2.1
+netlib>=0.9.2
+nose>=1.3.0
+pathod>=0.9.2
+pyOpenSSL>=0.13
+pyasn1>=0.1.7
+requests>=1.2.2
+urwid>=1.1.1
+wsgiref>=0.1.2
+jsbeautifier>=1.4.0
\ No newline at end of file

Add server connect script hook as requested here: https://groups.google.com/forum/#!topic/mitmproxy/6FDkWfrh3HE

_Aldo_: We have ClientConnect and ClientDisconnect vs ServerConnection classes in mitmproxy. To provide an unified API, I opted for a serverconnect scripthook. Are there any planned internal refactorings? If there are no obligations from your side, leave a comment and I'll add docs and merge.

Cheers,
Max

PS: Branching with multiple remotes sucks, PR https://github.com/mitmproxy/mitmproxy/pull/168 is included here. I apologize! As there are no significant changes in it, I let it just as is...
