@Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { inner.connect(endpoint, timeout); setAllSocketOptions(); }
@Override public void connect(final SocketAddress endpoint) throws IOException { inner.connect(endpoint); setAllSocketOptions(); }
@Override public void connect(SocketAddress endpoint) throws IOException { connect(endpoint, 0); }
@Override public void connect(SocketAddress endpoint) throws IOException { connect(endpoint, 0); }
@Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { inner.connect(endpoint, timeout); setAllSocketOptions(); }
@Override public void connect(final SocketAddress endpoint) throws IOException { inner.connect(endpoint); setAllSocketOptions(); }
/** * Creates a new {@link AFUNIXSocket} and connects it to the given {@link AFUNIXSocketAddress}. * * @param addr The address to connect to. * @return A new, connected socket. */ public static AFUNIXSocket connectTo(AFUNIXSocketAddress addr) throws IOException { AFUNIXSocket socket = newInstance(); socket.connect(addr); return socket; }
@Override public void connect(final SocketAddress endpoint, final int timeout) throws IOException { inner.connect(endpoint, timeout); setAllSocketOptions(); }
/** * Creates a new {@link AFUNIXSocket} and connects it to the given {@link AFUNIXSocketAddress}. * * @param addr The address to connect to. * @return A new, connected socket. * @throws IOException if the operation fails. */ public static AFUNIXSocket connectTo(AFUNIXSocketAddress addr) throws IOException { AFUNIXSocket socket = newInstance(); socket.connect(addr); return socket; }
@Override public void connect(final SocketAddress endpoint) throws IOException { inner.connect(endpoint); setAllSocketOptions(); }
UnixPipe(IPCClient ipcClient, HashMap<String, Callback> callbacks, String location) throws IOException { super(ipcClient, callbacks); socket = AFUNIXSocket.newInstance(); socket.connect(new AFUNIXSocketAddress(new File(location))); }
sock.connect(new AFUNIXSocketAddress(socketFile)); } catch (SocketException e) { System.out.println("Cannot connect to server. Have you started it?");
((AFUNIXSocket) socket).setSoTimeout((int) timeUnit.toMillis(timeout)); ((AFUNIXSocket) socket).connect(new AFUNIXSocketAddress(socketFile));
/** * Start the proxy * @return the proxy's listening socket address * @throws IOException on socket binding failure */ public InetSocketAddress start() throws IOException { listenSocket = new ServerSocket(); listenSocket.bind(new InetSocketAddress(listenHostname, listenPort)); logger.debug("Listening on {} and proxying to {}", listenSocket.getLocalSocketAddress(), unixSocketFile.getAbsolutePath()); acceptThread = new Thread(() -> { while (running) { try { Socket incomingSocket = listenSocket.accept(); logger.debug("Accepting incoming connection from {}", incomingSocket.getRemoteSocketAddress()); AFUNIXSocket outgoingSocket = AFUNIXSocket.newInstance(); outgoingSocket.connect(new AFUNIXSocketAddress(unixSocketFile)); new ProxyPump(incomingSocket, outgoingSocket); } catch (IOException ignored) { } } }); acceptThread.setDaemon(true); acceptThread.setName("tcp-unix-proxy-accept-thread"); acceptThread.start(); return (InetSocketAddress) listenSocket.getLocalSocketAddress(); }
/** * Uses the {@link #socketFile} property as the path to initiate a file socket ignoring all parameters of this * method. * * @param host Unsupported, will be ignored * @param port Unsupported, will be ignored * * @return unix socket * * @throws IOException if the file system location cannot be URL decoded */ @Override public Socket createSocket(final String host, final int port) throws IOException { final File file; if (socketFile == null) { throw new IOException("socketFile (specified in org.ldaptive.ldapi.socketFile" + " or passed through factory constructor) MUST be specified to call this method."); } file = new File(URLDecoder.decode(socketFile, "UTF-8")); final AFUNIXSocketAddress localAddress = new AFUNIXSocketAddress(file); final AFUNIXSocket sock = AFUNIXSocket.newInstance(); sock.connect(localAddress); return sock; }
((AFUNIXSocket) socket).connect(new AFUNIXSocketAddress(socketFile));