-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyProxy.java
More file actions
45 lines (41 loc) · 1.21 KB
/
MyProxy.java
File metadata and controls
45 lines (41 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.File;
import java.io.IOException;
import java.net.*;
import java.util.*;
public class MyProxy implements Runnable{
ServerSocket serverSocket;
boolean isRunning;
HashMap<String, File> cachedPages;
ArrayList<Thread> listOfRunningThreads;
public MyProxy(int i) {
cachedPages=new HashMap<>();
listOfRunningThreads=new ArrayList<>();
new Thread(this).start();
try {
serverSocket=new ServerSocket(i);
System.out.println("Server Socket is running!");
System.out.println("Waiting on port: "+serverSocket.getLocalPort());
} catch (IOException e) {
e.printStackTrace();
}
}
public void listen() {
}
public void run(){
//Just for commands
Scanner scanner=new Scanner(System.in);
String command;
while(true){
System.out.println("Give me command");
command=scanner.next();
switch (command){
case "XD":
System.out.println("Tak XD");
break;
default:
System.out.println("Nie XD");
break;
}
}
}
}