Java Doc for TestService.java in  » Net » socks » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » socks » test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   test.TestService

All known Subclasses:   test.TestClient,
TestService
public class TestService implements Runnable(Code)
Server to used perform tests for SOCKS library.


Field Summary
final static  intBUF_SIZE
    
final static  intCHARGEN
    
final static  intCHARGEN_WAIT
    
final static  intCONNECT
    
final static  intDISCARD
    
final static  intECHO
    
final static  intMAX_WAIT
    
final static  StringchargenSequence
    
static  PrintStreamlog
    
 Sockets
    
 intservice
    
final static  StringserviceNames
    
final static  intservicePorts
    

Constructor Summary
public  TestService(Socket s, int service)
     Creates new TestService object, which will perform particular service on given socket.
public  TestService()
     Default constructor.

Method Summary
public static  voidchargen(Socket s, long wait_time, long max_wait)
     Generates characters and sends them to the socket.

Unlike usual chargen (port 19), each next line of the generated output is send after increasingly larger time intervals.

public static  voidconnect(Socket s)
     Models connect back situation.

Reads a line from the socket connection, line should be in the form port service_id.

public static  voiddiscard(Socket s)
     Reads input from the socket, and does not write anything back.
public static  voidecho(Socket s)
     Echos any input on the socket to the output.
public static  intgetServiceId(String serviceName)
     Maps service name to the integer id, does it in simple linear search manner.
Parameters:
  serviceName - Name of the service whose id one needs.
static synchronized  voidlog(String s)
     Performs logging.
public static  voidpipe(InputStream in, OutputStream out)
     Pipes data from the input stream to the output.
public  voidrun()
    
public static  booleanserve(Socket s, int service)
     Performs given service on given socket.

Simply looks up and calls associated method.
Parameters:
  s - Socket on which to perform service.
Parameters:
  service - Id of the service to perform.


Field Detail
BUF_SIZE
final static int BUF_SIZE(Code)



CHARGEN
final static int CHARGEN(Code)



CHARGEN_WAIT
final static int CHARGEN_WAIT(Code)



CONNECT
final static int CONNECT(Code)



DISCARD
final static int DISCARD(Code)



ECHO
final static int ECHO(Code)



MAX_WAIT
final static int MAX_WAIT(Code)



chargenSequence
final static String chargenSequence(Code)



log
static PrintStream log(Code)



s
Socket s(Code)



service
int service(Code)



serviceNames
final static String serviceNames(Code)



servicePorts
final static int servicePorts(Code)




Constructor Detail
TestService
public TestService(Socket s, int service)(Code)
Creates new TestService object, which will perform particular service on given socket.
Parameters:
  s - Socket on which to perform service.
Parameters:
  service - Service which to provide.



TestService
public TestService()(Code)
Default constructor.




Method Detail
chargen
public static void chargen(Socket s, long wait_time, long max_wait) throws IOException(Code)
Generates characters and sends them to the socket.

Unlike usual chargen (port 19), each next line of the generated output is send after increasingly larger time intervals. It starts from wait_time (ms), and each next time wait time is doubled. Eg. 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 ... well you got the idea.

It starts if either connection is clsoed or the wait time grows bigger than max_wait.
Parameters:
  s - Socket on which to perform service.
Parameters:
  wait_time - Time in ms, from which timing sequence should begin.
Parameters:
  max_wait - Time in ms, after reaching timeout greater than thisvalue, chargen will stop.




connect
public static void connect(Socket s) throws IOException(Code)
Models connect back situation.

Reads a line from the socket connection, line should be in the form port service_id. Connects back to the remote host to port specified in the line, if successful performs a service speciefied by id on that new connection. If accept was successful closes the control connection, else outputs error message, and then closes the connection.
Parameters:
  s - Control connection.




discard
public static void discard(Socket s) throws IOException(Code)
Reads input from the socket, and does not write anything back. logs input in line by line fashion.
Parameters:
  s - Socket on which to perform service.



echo
public static void echo(Socket s) throws IOException(Code)
Echos any input on the socket to the output. Echo is being done line by line.
Parameters:
  s - Socket on which to perform service.



getServiceId
public static int getServiceId(String serviceName)(Code)
Maps service name to the integer id, does it in simple linear search manner.
Parameters:
  serviceName - Name of the service whose id one needs. Integer identifier for this servuce, or -1, if servicecan't be found.



log
static synchronized void log(String s)(Code)
Performs logging.



pipe
public static void pipe(InputStream in, OutputStream out) throws IOException(Code)
Pipes data from the input stream to the output.
Parameters:
  in - Input stream.
Parameters:
  out - Output stream.



run
public void run()(Code)



serve
public static boolean serve(Socket s, int service) throws IOException(Code)
Performs given service on given socket.

Simply looks up and calls associated method.
Parameters:
  s - Socket on which to perform service.
Parameters:
  service - Id of the service to perform. true if service have been found, false otherwise.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.