Fixed server capabilities and issues when closing the connection when used as a client or a server.