File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ package io .socket ;
2+
3+ import io .socket .client .IO ;
4+ import io .socket .client .Manager ;
5+ import io .socket .client .Socket ;
6+ import okhttp3 .OkHttpClient ;
7+
8+ import javax .net .ssl .*;
9+ import java .io .File ;
10+ import java .io .FileInputStream ;
11+ import java .io .FileNotFoundException ;
12+ import java .io .IOException ;
13+ import java .net .URI ;
14+ import java .security .*;
15+ import java .security .cert .CertificateException ;
16+ import java .security .cert .X509Certificate ;
17+ import java .util .concurrent .ExecutorService ;
18+
19+ public class Fiddle {
20+
21+ public static void main (String [] argz ) throws Exception {
22+ IO .Options options = new IO .Options ();
23+
24+ Socket socket = IO .socket (URI .create ("http://localhost:3000" ), options );
25+
26+ socket .on (Socket .EVENT_CONNECT , (__ ) -> {
27+ System .out .println ("connect" );
28+ });
29+
30+ socket .on (Socket .EVENT_CONNECT_ERROR , (args ) -> {
31+ System .out .println ("connect_error: " + args [0 ]);
32+ });
33+
34+ socket .on (Socket .EVENT_DISCONNECT , (args ) -> {
35+ System .out .println ("disconnect due to: " + args [0 ]);
36+ });
37+
38+ socket .connect ();
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments