Is there a free platform to host coding challenges within a class?
It doesn't do ranking in any manner, but CodingBat permits you to create challenges with tests for your class in either Python or Java.

While the interface begins assuming that you will have one method, you can add as many methods as you wish.  However, you are limited to one class (so no inner classes), and you are forbidden Exceptions, so the projects would have to be fairly small in scope.