01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.harmony.luni.net;
17:
18: import java.io.FileDescriptor;
19: import java.net.DatagramSocketImpl;
20: import java.net.InetAddress;
21: import java.net.Proxy;
22: import java.net.SocketImpl;
23:
24: public class SocketImplProvider {
25:
26: public static SocketImpl getSocketImpl() {
27: return new PlainSocketImpl2();
28: }
29:
30: /**
31: * gets a SocketImpl with specified proxy.
32: */
33: public static SocketImpl getSocketImpl(Proxy proxy) {
34: return new PlainSocketImpl2(proxy);
35: }
36:
37: public static SocketImpl getSocketImpl(FileDescriptor fd,
38: int localport, InetAddress addr, int port) {
39: return new PlainSocketImpl2(fd, localport, addr, port);
40: }
41:
42: public static SocketImpl getServerSocketImpl() {
43: return new PlainServerSocketImpl();
44: }
45:
46: public static SocketImpl getServerSocketImpl(FileDescriptor fd) {
47: return new PlainServerSocketImpl(fd);
48: }
49:
50: public static DatagramSocketImpl getDatagramSocketImpl() {
51: return new PlainDatagramSocketImpl();
52: }
53:
54: public static DatagramSocketImpl getMulticastSocketImpl() {
55: return new PlainMulticastSocketImpl();
56: }
57:
58: public static DatagramSocketImpl getDatagramSocketImpl(
59: FileDescriptor fd, int localPort) {
60: return new PlainDatagramSocketImpl(fd, localPort);
61: }
62:
63: }
|