01: package vicazh.hyperpool.stream.net.socks;
02:
03: import java.io.*;
04: import java.net.*;
05: import vicazh.hyperpool.Service;
06: import vicazh.hyperpool.Start;
07: import vicazh.hyperpool.stream.*;
08:
09: class InClientStream extends ClientStream {
10:
11: InClientStream(Connection connection, OutputStream outputstream) {
12: super (connection, outputstream);
13: }
14:
15: UDPInService service;
16:
17: public void head(int command, int type, byte[] address, int port)
18: throws IOException {
19: Start.logger.finest("command:"
20: + command
21: + " type:"
22: + type
23: + " address:"
24: + (type == 3 ? address : InetAddress
25: .getByAddress(address)) + " port:" + port);
26: if (command == 3) {
27: service = new UDPInService(
28: ((InService) connection.element).size);
29: service.setElement(((Service) connection.element)
30: .getElement());
31: service.setPort(0);
32: if (service.socket == null)
33: throw new BreakException();
34: service.socket
35: .setSoTimeout(((InService) connection.element).timeout);
36: service.stream = this ;
37: }
38: super .head(command, type, address, port);
39: }
40:
41: public void close() throws IOException {
42: try {
43: service.socket.close();
44: } catch (Exception e) {
45: }
46: super.close();
47: }
48:
49: }
|