HttpServlet includes support for the HTTP protocol like HTTP response codes, methods to handle the HTTP verbs (GET, PUT, POST) and functionality to automatically parse the HTTP headers and expose these values etc.
A basic
servlet provides CGI type support... you can use your own protocol and handle it within the service() method.