Server : Add a basic trait.

This commit is contained in:
Dmitry Voronin 2024-09-23 15:49:24 +03:00
parent 9086242ef6
commit f79582b86e
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,6 @@
package com.voronind.doublegis.test
package model.server
trait Server {
def listen(port: Int): Unit
}

View file

@ -5,8 +5,8 @@ import model.handler.TitleCrawlerHandler
import com.sun.net.httpserver.HttpServer
import java.net.InetSocketAddress
class TitleCrawlerServer {
def listen(port: Int): Unit = {
class TitleCrawlerServer extends Server {
override def listen(port: Int): Unit = {
val server = HttpServer.create(new InetSocketAddress(port), 0)
server.createContext(TitleCrawlerHandler.context, new TitleCrawlerHandler())
server.setExecutor(null)