protected OutputStream socketOutputStream() { final ResilentSocketOutputStream outputStream = new ResilentSocketOutputStream(host, port, connectionTimeoutMs, sendBufferSize, socketFactory); outputStream.setContext(context); return outputStream; } }
/** * Creates a new stream based on the socket configuration. * * @param host The host or an IP address of the server. * @param port The port on the server which accepts TCP connections. * @param connectionTimeoutMs The timeout for establishing a new TCP connection. * @param sendBufferSize The size of the send buffer of the socket stream in bytes. * @param socketFactory The factory for customizing the client socket. */ public ResilentSocketOutputStream(String host, int port, int connectionTimeoutMs, int sendBufferSize, SocketFactory socketFactory) { this.host = host; this.port = port; this.connectionTimeoutMs = connectionTimeoutMs; this.sendBufferSize = sendBufferSize; this.socketFactory = socketFactory; try { this.os = openNewOutputStream(); } catch (IOException e) { throw new IllegalStateException("Unable to create a TCP connection to " + host + ":" + port, e); } this.presumedClean = true; }
protected OutputStream socketOutputStream() { final ResilentSocketOutputStream outputStream = new ResilentSocketOutputStream(host, port, connectionTimeoutMs, sendBufferSize, socketFactory); outputStream.setContext(context); return outputStream; } }
/** * Creates a new stream based on the socket configuration. * * @param host The host or an IP address of the server. * @param port The port on the server which accepts TCP connections. * @param connectionTimeoutMs The timeout for establishing a new TCP connection. * @param sendBufferSize The size of the send buffer of the socket stream in bytes. * @param socketFactory The factory for customizing the client socket. */ public ResilentSocketOutputStream(String host, int port, int connectionTimeoutMs, int sendBufferSize, SocketFactory socketFactory) { this.host = host; this.port = port; this.connectionTimeoutMs = connectionTimeoutMs; this.sendBufferSize = sendBufferSize; this.socketFactory = socketFactory; try { this.os = openNewOutputStream(); } catch (IOException e) { throw new IllegalStateException("Unable to create a TCP connection to " + host + ":" + port, e); } this.presumedClean = true; }