List of usage examples for org.apache.http.params HttpConnectionParams getSocketBufferSize
public static int getSocketBufferSize(HttpParams httpParams)
From source file:com.facebook.stetho.server.LocalSocketHttpServerConnection.java
public void bind(LocalSocket socket, HttpParams params) throws IOException { Util.throwIfNull(socket);// w w w . j a v a2s .co m Util.throwIfNull(params); mSocket = socket; int bufferSize = HttpConnectionParams.getSocketBufferSize(params); mInputBuffer = new LocalSocketSessionInputBuffer(socket, bufferSize, params); init(mInputBuffer, new LocalSocketSessionOutputBuffer(socket, bufferSize, params), params); mOpen = true; }
From source file:net.oneandone.sushi.fs.webdav.WebdavConnection.java
public static WebdavConnection open(Socket socket, HttpParams params) throws IOException { int linger;// ww w . j a va 2 s . com int buffersize; SessionInputBuffer input; SessionOutputBuffer output; socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params)); socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params)); linger = HttpConnectionParams.getLinger(params); if (linger >= 0) { socket.setSoLinger(linger > 0, linger); } buffersize = HttpConnectionParams.getSocketBufferSize(params); if (WebdavFilesystem.WIRE.isLoggable(Level.FINE)) { input = new LoggingSessionInputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE); output = new LoggingSessionOutputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE); } else { input = new SocketInputBuffer(socket, buffersize, params); output = new SocketOutputBuffer(socket, buffersize, params); } return new WebdavConnection(socket, input, output, params); }
From source file:com.grendelscan.proxy.ssl.TunneledSSLConnection.java
public TunneledSSLConnection(Socket socket, String destinationHostname) throws SSLException, IOException, GeneralSecurityException { LOGGER.trace("Instantiating TunneledSSLConnection"); this.destinationHostname = destinationHostname; this.socket = socket; if (socket == null) { IllegalArgumentException e = new IllegalArgumentException("socket cannot be null"); LOGGER.error("Socket cannot be null", e); throw e;/* w ww. j a v a 2s . c om*/ } if (destinationHostname == null) { IllegalArgumentException e = new IllegalArgumentException("destinationHostname cannot be null"); LOGGER.error("destinationHostname cannot be null", e); throw e; } SSLSocketFactory sslSocketFactory = initializeSSLFactory(); HttpParams params = MiscHttpFactory.createDefaultHttpProxyParams(); int buffersize = HttpConnectionParams.getSocketBufferSize(params); sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket, socket.getInetAddress().getHostAddress(), socket.getPort(), true); sslSocket.setUseClientMode(false); sslInputStream = sslSocket.getInputStream(); sslTunnelInputBuffer = new SSLTunnelInputBuffer(sslInputStream, buffersize, params); sslOutputStream = sslSocket.getOutputStream(); sslTunnelOutputBuffer = new SSLTunnelOutputBuffer(sslOutputStream, buffersize, params); // This is the real important part where we identify the buffers to the parent init(sslTunnelInputBuffer, sslTunnelOutputBuffer, params); open = true; }
From source file:org.apache.axis2.transport.http.server.AxisHttpConnectionImpl.java
public AxisHttpConnectionImpl(final Socket socket, final HttpParams params) throws IOException { super();//from w w w .j a v a 2 s . c o m if (socket == null) { throw new IllegalArgumentException("Socket may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params)); socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params)); int linger = HttpConnectionParams.getLinger(params); if (linger >= 0) { socket.setSoLinger(linger > 0, linger); } int buffersize = HttpConnectionParams.getSocketBufferSize(params); this.socket = socket; this.outbuffer = new SocketOutputBuffer(socket, buffersize, params); this.inbuffer = new SocketInputBuffer(socket, buffersize, params); this.contentLenStrategy = new StrictContentLengthStrategy(); this.requestParser = new HttpRequestParser(this.inbuffer, null, new DefaultHttpRequestFactory(), params); this.responseWriter = new HttpResponseWriter(this.outbuffer, null, params); }
From source file:org.mycard.net.network.AndroidHttpClientConnection.java
/*** * Bind socket and set HttpParams to AndroidHttpClientConnection * @param socket outgoing socket//from w w w . ja va 2 s .c o m * @param params HttpParams * @throws IOException */ public void bind(final Socket socket, final HttpParams params) throws IOException { if (socket == null) { throw new IllegalArgumentException("Socket may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } assertNotOpen(); socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params)); socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params)); int linger = HttpConnectionParams.getLinger(params); if (linger >= 0) { socket.setSoLinger(linger > 0, linger); } this.socket = socket; int buffersize = HttpConnectionParams.getSocketBufferSize(params); this.inbuffer = new SocketInputBuffer(socket, buffersize, params); this.outbuffer = new SocketOutputBuffer(socket, buffersize, params); maxHeaderCount = params.getIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, -1); maxLineLength = params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1); this.requestWriter = new HttpRequestWriter(outbuffer, null, params); this.metrics = new HttpConnectionMetricsImpl(inbuffer.getMetrics(), outbuffer.getMetrics()); this.open = true; }