Client application terminated after connecting