01: package vicazh.hyperpool.stream.net.socks;
02:
03: import java.io.*;
04: import vicazh.hyperpool.stream.Connection;
05:
06: /**
07: * This class is the superclass of all socks server stream data
08: *
09: * @author Victor Zhigunov
10: * @version 0.3.14
11: */
12: public class ServerStream extends Stream {
13: public ServerStream() {
14: }
15:
16: /**
17: * @param connection
18: * parent connection
19: * @param outputstream
20: * linked output stream
21: */
22: public ServerStream(Connection connection, OutputStream outputstream) {
23: super (connection, outputstream);
24: }
25:
26: private int method;
27:
28: /**
29: * Set the method
30: */
31: public void setMethod(int method) {
32: this .method = method;
33: }
34:
35: /**
36: * Get the method
37: */
38: public int getMethod() {
39: return method;
40: }
41:
42: private int index;
43:
44: public void write(int b) throws IOException {
45: if (mode == Mode.AUTH) {
46: if (index == 1)
47: auth(new byte[] { (byte) method });
48: index++;
49: } else
50: super.write(b);
51: }
52: }
|