Mercurial > hg > Applications > TightVNC_orginal
comparison src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java @ 34:f70008073a03
add TreeViewer.java
author | one |
---|---|
date | Tue, 04 Sep 2012 19:02:04 +0900 |
parents | 9d3478d11d3b |
children | 1b81deb0abb3 |
comparison
equal
deleted
inserted
replaced
33:9d3478d11d3b | 34:f70008073a03 |
---|---|
1 package jp.ac.u_ryukyu.treevnc.server; | 1 package jp.ac.u_ryukyu.treevnc.server; |
2 | 2 |
3 import static org.junit.Assert.*; | 3 //import static org.junit.Assert.*; |
4 //import org.junit.Test; | |
4 | 5 |
5 import java.io.IOException; | 6 import java.io.IOException; |
6 import java.net.BindException; | 7 import java.net.BindException; |
7 import java.net.ServerSocket; | 8 import java.net.ServerSocket; |
8 import java.net.Socket; | 9 import java.net.Socket; |
9 import java.nio.ByteBuffer; | 10 import java.nio.ByteBuffer; |
10 import java.util.Iterator; | 11 import java.util.Iterator; |
11 import java.util.LinkedList; | 12 import java.util.LinkedList; |
12 | |
13 | |
14 import org.junit.Test; | |
15 | |
16 import com.glavsoft.exceptions.TransportException; | 13 import com.glavsoft.exceptions.TransportException; |
17 import com.glavsoft.rfb.encoding.EncodingType; | 14 import com.glavsoft.rfb.encoding.EncodingType; |
18 import com.glavsoft.rfb.protocol.Protocol; | |
19 import com.glavsoft.rfb.protocol.ProtocolContext; | |
20 import com.glavsoft.transport.Reader; | 15 import com.glavsoft.transport.Reader; |
21 import com.glavsoft.transport.Writer; | 16 import com.glavsoft.transport.Writer; |
22 | |
23 //import myVncProxy.MulticastQueue.Client; | |
24 | |
25 import java.util.concurrent.ExecutorService; | 17 import java.util.concurrent.ExecutorService; |
26 import java.util.zip.DataFormatException; | 18 import java.util.zip.DataFormatException; |
27 import java.util.zip.Deflater; | 19 import java.util.zip.Deflater; |
28 import java.util.zip.Inflater; | 20 import java.util.zip.Inflater; |
29 | 21 |
30 import jp.ac.u_ryukyu.treevnc.MulticastQueue; | |
31 import jp.ac.u_ryukyu.treevnc.MyRfbProto; | 22 import jp.ac.u_ryukyu.treevnc.MyRfbProto; |
32 | 23 |
33 public class MyRfbProtoProxy extends MyRfbProto { | 24 public class MyRfbProtoProxy extends MyRfbProto { |
34 final static String versionMsg_3_855 = "RFB 003.855\n"; | 25 final static String versionMsg_3_855 = "RFB 003.855\n"; |
35 /** | 26 /** |
363 System.err.print(" " + end.get(i)); | 354 System.err.print(" " + end.get(i)); |
364 } | 355 } |
365 System.err.println(); | 356 System.err.println(); |
366 } | 357 } |
367 | 358 |
359 /* | |
368 @Test | 360 @Test |
369 public void test1() { | 361 public void test1() { |
370 try { | 362 try { |
371 LinkedList<ByteBuffer> in = new LinkedList<ByteBuffer>(); | 363 LinkedList<ByteBuffer> in = new LinkedList<ByteBuffer>(); |
372 LinkedList<ByteBuffer> out = new LinkedList<ByteBuffer>(); | 364 LinkedList<ByteBuffer> out = new LinkedList<ByteBuffer>(); |
409 System.out.println("Test Ok. " + len); | 401 System.out.println("Test Ok. " + len); |
410 } catch (Exception e) { | 402 } catch (Exception e) { |
411 assertEquals(0, 1); | 403 assertEquals(0, 1); |
412 } | 404 } |
413 } | 405 } |
414 | 406 */ |
407 | |
415 private LinkedList<ByteBuffer> clone(LinkedList<ByteBuffer> in) { | 408 private LinkedList<ByteBuffer> clone(LinkedList<ByteBuffer> in) { |
416 LinkedList<ByteBuffer> copy = new LinkedList<ByteBuffer>(); | 409 LinkedList<ByteBuffer> copy = new LinkedList<ByteBuffer>(); |
417 for (ByteBuffer b : in) { | 410 for (ByteBuffer b : in) { |
418 ByteBuffer c = b.duplicate(); | 411 ByteBuffer c = b.duplicate(); |
419 copy.add(c); | 412 copy.add(c); |
420 } | 413 } |
421 return copy; | 414 return copy; |
422 } | 415 } |
423 | 416 |
417 /* | |
424 public int equalByteBuffers(LinkedList<ByteBuffer> in, | 418 public int equalByteBuffers(LinkedList<ByteBuffer> in, |
425 LinkedList<ByteBuffer> out2) { | 419 LinkedList<ByteBuffer> out2) { |
426 int len = 0; | 420 int len = 0; |
427 Iterable<Byte> i = byteBufferIterator(in); | 421 Iterable<Byte> i = byteBufferIterator(in); |
428 Iterator<Byte> o = byteBufferIterator(out2).iterator(); | 422 Iterator<Byte> o = byteBufferIterator(out2).iterator(); |
438 if (o.hasNext()) | 432 if (o.hasNext()) |
439 assertEquals(0, 1); | 433 assertEquals(0, 1); |
440 // System.out.println(); | 434 // System.out.println(); |
441 return len; | 435 return len; |
442 } | 436 } |
437 */ | |
443 | 438 |
444 private Iterable<Byte> byteBufferIterator(final LinkedList<ByteBuffer> in) { | 439 private Iterable<Byte> byteBufferIterator(final LinkedList<ByteBuffer> in) { |
445 return new Iterable<Byte>() { | 440 return new Iterable<Byte>() { |
446 public Iterator<Byte> iterator() { | 441 public Iterator<Byte> iterator() { |
447 return new Iterator<Byte>() { | 442 return new Iterator<Byte>() { |