Code examples for ServerSocket

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
49:	ServerSocket socket2 = new ServerSocket(); 
-
51:	Server.bind(socket2, address2, 10, conf, "TestRange"); 
-
53:	assertTrue(socket2.isBound()); 
54:	assertTrue(socket2.getLocalPort() > min); 
55:	assertTrue(socket2.getLocalPort() <= max); 
-
57:	socket2.close(); 
Full Snippet Info
9
CodeRank
66:	serverSocket = new ServerSocket(); 
-
68:	serverSocket.setReuseAddress(true); 
-
70:	serverSocket.bind(bindAddr, listenBacklog); 
Full Snippet Info
8
CodeRank
123:	socket = new ServerSocket(); 
124:	socket.setReuseAddress(true); 
125:	socket.bind(new InetSocketAddress("localhost", port)); 
126:	int localPort = socket.getLocalPort(); 
127:	socket.close(); 
Full Snippet Info
8
CodeRank
98:	ServerSocket socket4 = new ServerSocket(); 
-
104:	when(this.factory.createServerSocket("test", 1, 0, localhost)).thenReturn(socket4); 
-
114:	verify(this.manager.getUnnamedRegistry()).registerSocket(socket4); 
Full Snippet Info
8
CodeRank
97:	this.serverSocket = new java.net.ServerSocket(COMM_PORT); 
98:	assert this.serverSocket.isBound(); 
99:	if (this.serverSocket.isBound()) { 
100:	System.out.println("SERVER inbound data port " + this.serverSocket.getLocalPort() 
Full Snippet Info
8
CodeRank
81:	socket = new ServerSocket(0); 
-
83:	return socket.getLocalPort(); 
-
86:	socket.close(); 
Full Snippet Info
8
CodeRank
124:	return !socket.isClosed(); 
-
129:	return isOpen() && socket.isBound(); 
Full Snippet Info
8
CodeRank
59:	if(pServerSocket != null && !pServerSocket.isClosed()) { 
-
61:	pServerSocket.close(); 
Full Snippet Info
8
CodeRank
190:	server = new ServerSocket(0); 
191:	return server.getLocalPort(); 
-
203:	server.close(); 
Full Snippet Info
8
CodeRank
81:	ss = new ServerSocket(); 
82:	ss.setReuseAddress(false); 
83:	ss.bind(localAddress); 
84:	ss.close(); 
-
92:	ss.close(); 
Full Snippet Info
7
CodeRank
82:	serverSocket.close(); 
-
84:	ROOT_LOGGER.failedToCloseServerSocket(e, serverSocket); 
Full Snippet Info
7
CodeRank
103:	serverSocket_ = new ServerSocket(); 
-
105:	serverSocket_.setReuseAddress(true); 
-
107:	serverSocket_.bind(bindAddr); 
Full Snippet Info
7
CodeRank
105:	socket = new ServerSocket(); 
106:	socket.bind(new InetSocketAddress(host, bindPort)); 
Full Snippet Info
7
CodeRank
157:	ss = new ServerSocket(port); 
158:	ss.setReuseAddress(true); 
-
170:	ss.close(); 
Full Snippet Info
7
CodeRank
123:	serverSocket.getInetAddress().getHostAddress(), 
124:	serverSocket.getLocalPort()); 
Full Snippet Info
7
CodeRank
182:	assertFalse(s.isBound()); 
183:	assertNull(s.getInetAddress()); 
184:	assertEquals(-1, s.getLocalPort()); 
185:	assertNull(s.getLocalSocketAddress()); 
-
187:	assertEquals(0, s.getSoTimeout()); 
Full Snippet Info
7
CodeRank
43:	ServerSocket ss = new ServerSocket(0); 
44:	int port = ss.getLocalPort(); 
-
51:	Socket s = ss.accept(); 
-
53:	ss.close(); 
Full Snippet Info
7
CodeRank
113:	ServerSocket ss = new ServerSocket(0); 
-
127:	NetUtils.connect(s, ss.getLocalSocketAddress(), 1000); 
-
148:	ss.close(); 
Full Snippet Info
7
CodeRank
49:	ServerSocket socket2 = new ServerSocket(); 
-
51:	Server.bind(socket2, address2, 10, conf, "TestRange"); 
-
53:	assertTrue(socket2.isBound()); 
54:	assertTrue(socket2.getLocalPort() > min); 
55:	assertTrue(socket2.getLocalPort() <= max); 
-
57:	socket2.close(); 
Full Snippet Info
7
CodeRank
98:	ServerSocket ss = new ServerSocket(port); 
-
100:	ss.setReuseAddress(true); 
-
102:	ss.close(); 
Full Snippet Info
7
CodeRank