Home
last modified time | relevance | path

Searched refs:socket (Results 1 – 25 of 66) sorted by relevance

123

/libcore/luni/src/test/java/libcore/java/nio/channels/
DSocketChannelTest.java105 Socket scSocket = sc.socket(); in test_channelSocketOutputStreamClosureState()
126 Socket scSocket = sc.socket(); in test_channelSocketInputStreamClosureState()
144 assertNull(sc.socket().getLocalSocketAddress()); in test_open_initialState()
146 Socket socket = sc.socket(); in test_open_initialState() local
147 assertFalse(socket.isBound()); in test_open_initialState()
148 assertFalse(socket.isClosed()); in test_open_initialState()
149 assertFalse(socket.isConnected()); in test_open_initialState()
150 assertEquals(-1, socket.getLocalPort()); in test_open_initialState()
151 assertTrue(socket.getLocalAddress().isAnyLocalAddress()); in test_open_initialState()
152 assertNull(socket.getLocalSocketAddress()); in test_open_initialState()
[all …]
DDatagramChannelTest.java61 dc.socket().bind(null); in testNonBlockingRecv()
72 DatagramSocket socket = dc.socket(); in testInitialState() local
73 assertFalse(socket.isBound()); in testInitialState()
74 assertFalse(socket.getBroadcast()); in testInitialState()
75 assertFalse(socket.isClosed()); in testInitialState()
76 assertFalse(socket.isConnected()); in testInitialState()
77 assertEquals(0, socket.getLocalPort()); in testInitialState()
78 assertTrue(socket.getLocalAddress().isAnyLocalAddress()); in testInitialState()
79 assertNull(socket.getLocalSocketAddress()); in testInitialState()
80 assertNull(socket.getInetAddress()); in testInitialState()
[all …]
DServerSocketChannelTest.java38 ssc.socket().bind(null); in testNonBlockingAccept()
50 assertNull(ssc.socket().getLocalSocketAddress()); in test_open_initialState()
52 ServerSocket socket = ssc.socket(); in test_open_initialState() local
53 assertFalse(socket.isBound()); in test_open_initialState()
54 assertFalse(socket.isClosed()); in test_open_initialState()
55 assertEquals(-1, socket.getLocalPort()); in test_open_initialState()
56 assertNull(socket.getLocalSocketAddress()); in test_open_initialState()
57 assertNull(socket.getInetAddress()); in test_open_initialState()
58 assertTrue(socket.getReuseAddress()); in test_open_initialState()
60 assertSame(ssc, socket.getChannel()); in test_open_initialState()
[all …]
/libcore/luni/src/test/java/libcore/javax/net/ssl/
DSSLServerSocketTest.java32 SSLServerSocket socket = in testSetEnabledCipherSuitesAffectsGetter() local
34 String[] cipherSuites = new String[] {socket.getSupportedCipherSuites()[0]}; in testSetEnabledCipherSuitesAffectsGetter()
35 socket.setEnabledCipherSuites(cipherSuites); in testSetEnabledCipherSuitesAffectsGetter()
36 assertEquals(Arrays.asList(cipherSuites), Arrays.asList(socket.getEnabledCipherSuites())); in testSetEnabledCipherSuitesAffectsGetter()
40 SSLServerSocket socket = in testSetEnabledCipherSuitesStoresCopy() local
42 String[] array = new String[] {socket.getEnabledCipherSuites()[0]}; in testSetEnabledCipherSuitesStoresCopy()
44 socket.setEnabledCipherSuites(array); in testSetEnabledCipherSuitesStoresCopy()
46 assertEquals(originalFirstElement, socket.getEnabledCipherSuites()[0]); in testSetEnabledCipherSuitesStoresCopy()
50 SSLServerSocket socket = in testSetEnabledProtocolsAffectsGetter() local
52 String[] protocols = new String[] {socket.getSupportedProtocols()[0]}; in testSetEnabledProtocolsAffectsGetter()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/
DServerSocketChannelTest.java117 assertNull(ssc.socket().getLocalSocketAddress()); in test_bind_null()
119 ssc.socket().bind(null); in test_bind_null()
121 … InetSocketAddress localAddress = (InetSocketAddress) ssc.socket().getLocalSocketAddress(); in test_bind_null()
131 portHog.socket().bind(null); in test_bind_failure()
136 ssc.socket().bind(portHog.socket().getLocalSocketAddress()); in test_bind_failure()
150 ssc.socket().bind(null); in test_bind_closed()
161 portPickingChannel.socket().bind(null); in test_bind_explicitPort()
163 …InetSocketAddress address = (InetSocketAddress) portPickingChannel.socket().getLocalSocketAddress(… in test_bind_explicitPort()
171 ssc.socket().bind(bindAddress); in test_bind_explicitPort()
173 InetSocketAddress boundAddress = (InetSocketAddress) ssc.socket().getLocalSocketAddress(); in test_bind_explicitPort()
[all …]
DSocketChannelTest.java157 assertNull(channel1.socket().getLocalSocketAddress()); in testBind_Null()
159 channel1.socket().bind(null); in testBind_Null()
161 … InetSocketAddress localAddress = (InetSocketAddress) channel1.socket().getLocalSocketAddress(); in testBind_Null()
167 assertNull(channel1.socket().getLocalSocketAddress()); in testBind_Failure()
171 channel1.socket().bind(localAddr1); in testBind_Failure()
181 channel1.socket().bind(null); in testBind_Closed()
190 portPickingChannel.socket().bind(null); in testBind_explicitPort()
191 …InetSocketAddress address = (InetSocketAddress) portPickingChannel.socket().getLocalSocketAddress(… in testBind_explicitPort()
199 channel1.socket().setReuseAddress(true); in testBind_explicitPort()
200 channel1.socket().bind(bindAddress); in testBind_explicitPort()
[all …]
DDatagramChannelTest.java74 channel1.socket().bind(new InetSocketAddress(Inet6Address.LOOPBACK, 0)); in setUp()
75 channel2.socket().bind(new InetSocketAddress(Inet6Address.LOOPBACK, 0)); in setUp()
77 channel1Address = (InetSocketAddress) channel1.socket().getLocalSocketAddress(); in setUp()
78 channel2Address = (InetSocketAddress) channel2.socket().getLocalSocketAddress(); in setUp()
265 DatagramSocket s1 = dc.socket(); in testSocket_BasicStatusBeforeConnect()
284 DatagramSocket s2 = dc.socket(); in testSocket_BasicStatusBeforeConnect()
298 DatagramSocket s1 = dc.socket(); in testSocket_Block_BasicStatusAfterConnect()
300 DatagramSocket s2 = dc.socket(); in testSocket_Block_BasicStatusAfterConnect()
312 DatagramSocket s1 = dc.socket(); in testSocket_NonBlock_BasicStatusAfterConnect()
314 DatagramSocket s2 = dc.socket(); in testSocket_NonBlock_BasicStatusAfterConnect()
[all …]
DUnixSelectorTest.java32 ServerSocket socket = null; field in UnixSelectorTest.Server
39 this.socket = serverChannel.socket(); in initialize()
40 socket.bind(null); in initialize()
80 boolean isConnected = socketChannel.connect(server.socket.getLocalSocketAddress()); in testSelectorAcceptAndRead()
/libcore/luni/src/test/java/libcore/java/net/
DSocketTest.java93 ssc.socket().bind(listenAddr, 0); in checkSocketLocalAndRemoteAddresses()
94 ServerSocket ss = ssc.socket(); in checkSocketLocalAndRemoteAddresses()
100 out.socket().setTcpNoDelay(false); in checkSocketLocalAndRemoteAddresses()
102 InetSocketAddress addr = new InetSocketAddress(host, ssc.socket().getLocalPort()); in checkSocketLocalAndRemoteAddresses()
110 in.socket().setTcpNoDelay(false); in checkSocketLocalAndRemoteAddresses()
113 InetSocketAddress listenAddress = (InetSocketAddress) in.socket().getLocalSocketAddress(); in checkSocketLocalAndRemoteAddresses()
114 … InetSocketAddress outRemoteAddress = (InetSocketAddress) out.socket().getRemoteSocketAddress(); in checkSocketLocalAndRemoteAddresses()
115 … InetSocketAddress outLocalAddress = (InetSocketAddress) out.socket().getLocalSocketAddress(); in checkSocketLocalAndRemoteAddresses()
116 InetSocketAddress inLocalAddress = (InetSocketAddress) in.socket().getLocalSocketAddress(); in checkSocketLocalAndRemoteAddresses()
117 … InetSocketAddress inRemoteAddress = (InetSocketAddress) in.socket().getRemoteSocketAddress(); in checkSocketLocalAndRemoteAddresses()
[all …]
DOldAndroidDatagramTest.java42 DatagramSocket socket; field in OldAndroidDatagramTest.Reflector
59 socket.receive(packet); in run()
74 socket.send(packet); in run()
81 socket.close(); in run()
91 socket = new DatagramSocket(port, address); in Reflector()
121 DatagramSocket socket = null; in testDatagram() local
131 socket = new DatagramSocket(2345, InetAddress.getLocalHost()); in testDatagram()
141 socket.send(packet); in testDatagram()
150 socket.receive(packet); in testDatagram()
161 if (socket != null) { in testDatagram()
[all …]
DOldUnixSocketTest.java106 Socket socket = new Socket("127.0.0.1", port, false); in test_getOutputStream() local
107 OutputStream o = socket.getOutputStream(); in test_getOutputStream()
113 socket.close(); in test_getOutputStream()
/libcore/luni/src/main/java/java/nio/
DServerSocketChannelImpl.java45 private final ServerSocketAdapter socket; field in ServerSocketChannelImpl
51 this.socket = new ServerSocketAdapter(this); in ServerSocketChannelImpl()
54 @Override public ServerSocket socket() { in socket() method in ServerSocketChannelImpl
55 return socket; in socket()
63 if (!socket.isBound()) { in accept()
73 socket.implAccept(result); in accept()
102 IoUtils.setBlocking(socket.getFD$(), blocking); in implConfigureBlocking()
107 if (!socket.isClosed()) { in implCloseSelectableChannel()
108 socket.close(); in implCloseSelectableChannel()
114 return socket.getFD$(); in getFD()
[all …]
DDatagramChannelImpl.java58 private DatagramSocket socket; field in DatagramChannelImpl
83 fd = IoBridge.socket(false); in DatagramChannelImpl()
101 synchronized public DatagramSocket socket() { in socket() method in DatagramChannelImpl
102 if (socket == null) { in socket()
103 socket = new DatagramSocketAdapter(new PlainDatagramSocketImpl(fd, localPort), this); in socket()
105 return socket; in socket()
128 if (updateSocketState && socket != null) { in onBind()
129 socket.onBind(localAddress, localPort); in onBind()
179 if (updateSocketState && socket != null) { in onConnect()
180 socket.onConnect(remoteAddress, remotePort); in onConnect()
[all …]
DSocketChannelImpl.java74 private SocketAdapter socket = null; field in SocketChannelImpl
105 fd = (connect ? IoBridge.socket(true) : new FileDescriptor()); in SocketChannelImpl()
122 synchronized public Socket socket() { in socket() method in SocketChannelImpl
123 if (socket == null) { in socket()
131 socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); in socket()
136 return socket; in socket()
159 if (updateSocketState && socket != null) { in onBind()
160 socket.onBind(localAddress, localPort); in onBind()
240 if (status == SOCKET_STATUS_CONNECTED && updateSocketState && socket != null) { in onConnectStatusChanged()
241 socket.onConnect(connectAddress.getAddress(), connectAddress.getPort()); in onConnectStatusChanged()
[all …]
/libcore/dalvik/src/main/java/dalvik/system/
DSocketTagger.java52 public final void tag(Socket socket) throws SocketException { in tag() argument
53 if (!socket.isClosed()) { in tag()
54 tag(socket.getFileDescriptor$()); in tag()
58 public final void untag(Socket socket) throws SocketException { in untag() argument
59 if (!socket.isClosed()) { in untag()
60 untag(socket.getFileDescriptor$()); in untag()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/
DHandshakeCompletedEventTest.java75 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(); in test_Constructor() local
76 HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session); in test_Constructor()
90 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(); in test_getCipherSuite() local
91 HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session); in test_getCipherSuite()
101 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(); in test_getLocalCertificates() local
102 HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session); in test_getLocalCertificates()
112 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(); in test_getLocalPrincipal() local
113 HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session); in test_getLocalPrincipal()
124 SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(); in test_getPeerCertificateChain() local
125 HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session); in test_getPeerCertificateChain()
[all …]
/libcore/support/src/test/java/org/apache/harmony/xnet/tests/support/
DSSLSocketFactoryImpl.java17 public Socket createSocket(Socket socket, String s, int i, boolean flag) in createSocket() argument
19 if (socket == null) { in createSocket()
30 socket = new Socket(s, i); in createSocket()
32 socket = new Socket(s, i); in createSocket()
33 socket.close(); in createSocket()
35 return socket; in createSocket()
/libcore/luni/src/main/java/java/util/logging/
DSocketHandler.java63 private Socket socket; field in SocketHandler
117 this.socket = new Socket(host, p); in initSocket()
123 super.internalSetOutputStream(new BufferedOutputStream(this.socket.getOutputStream())); in initSocket()
133 if (this.socket != null) { in close()
134 this.socket.close(); in close()
135 this.socket = null; in close()
/libcore/luni/src/test/java/libcore/javax/net/
DServerSocketFactoryTest.java75 Socket socket = new Socket(InetAddress.getLocalHost(), serverSocket.getLocalPort()); in testSocket() local
79 InputStream in = socket.getInputStream(); in testSocket()
83 socket.close(); in testSocket()
98 Socket socket = new Socket(); in assertBacklog() local
99 backlog.add(socket); in assertBacklog()
100 socket.connect(serverAddress, 500); in assertBacklog()
109 for (Socket socket : backlog) { in assertBacklog()
110 socket.close(); in assertBacklog()
/libcore/support/src/test/java/tests/http/
DMockWebServer.java216 Socket socket; in play()
218 socket = serverSocket.accept(); in play()
225 socket.close(); in play()
227 openClientSockets.add(socket); in play()
228 serveConnection(socket); in play()
255 Socket socket; in serveConnection()
260 socket = sslSocketFactory.createSocket( in serveConnection()
262 ((SSLSocket) socket).setUseClientMode(false); in serveConnection()
263 openClientSockets.add(socket); in serveConnection()
266 socket = raw; in serveConnection()
[all …]
/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http/
DHttpURLConnectionTest.java91 Socket socket = serverSocket.accept(); in run() local
92 socket.setSoTimeout(1000); in run()
94 int num = socket.getInputStream().read(buff); in run()
95 socket.getOutputStream().write(( in run()
99 num = socket.getInputStream().read(buff); in run()
102 socket = serverSocket.accept(); in run()
103 socket.setSoTimeout(1000); in run()
104 num = socket.getInputStream().read(buff); in run()
110 socket.getOutputStream().write(( in run()
/libcore/support/src/test/java/libcore/javax/net/ssl/
DForwardingX509ExtendedKeyManager.java38 public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { in chooseClientAlias() argument
39 return delegate.chooseClientAlias(keyType, issuers, socket); in chooseClientAlias()
43 public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { in chooseServerAlias() argument
44 return delegate.chooseServerAlias(keyType, issuers, socket); in chooseServerAlias()
DTestKeyManager.java63 public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) { in chooseClientAlias() argument
71 dumpSocket(socket); in chooseClientAlias()
73 return dumpAlias(keyManager.chooseClientAlias(keyTypes, issuers, socket)); in chooseClientAlias()
88 public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { in chooseServerAlias() argument
94 dumpSocket(socket); in chooseServerAlias()
96 return dumpAlias(keyManager.chooseServerAlias(keyType, issuers, socket)); in chooseServerAlias()
99 private void dumpSocket(Socket socket) { in dumpSocket() argument
101 out.print(String.valueOf(socket)); in dumpSocket()
/libcore/luni/src/main/java/javax/net/ssl/
DX509KeyManager.java46 Socket socket); in chooseClientAlias() argument
64 Socket socket); in chooseServerAlias() argument
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/
DDatagramPacketTest.java134 DatagramSocket socket = new DatagramSocket(0, localhost); in test_getPort() local
135 final int port = socket.getLocalPort(); in test_getPort()
137 socket.setSoTimeout(3000); in test_getPort()
140 socket.send(packet); in test_getPort()
141 socket.receive(packet); in test_getPort()
142 socket.close(); in test_getPort()

123