()
| 52 | // 创建新的协议处理器 |
| 53 | Http11NioProtocol protocol1 = new Http11NioProtocol() { |
| 54 | @Override |
| 55 | protected Processor createProcessor() { |
| 56 | Http11Processor http11Processor = new Http11Processor(protocol.getMaxHttpHeaderSize(), |
| 57 | protocol.getAllowHostHeaderMismatch(), |
| 58 | protocol.getRejectIllegalHeaderName(), endpoint1, |
| 59 | protocol.getMaxTrailerSize(), |
| 60 | Collections.singleton(protocol.getAllowedTrailerHeaders()), |
| 61 | protocol.getMaxExtensionSize(), |
| 62 | protocol.getMaxSwallowSize(), |
| 63 | null, |
| 64 | protocol.getSendReasonPhrase(), |
| 65 | protocol.getRelaxedPathChars(), |
| 66 | protocol.getRelaxedQueryChars()) { |
| 67 | @Override |
| 68 | public AbstractEndpoint.Handler.SocketState process(SocketWrapperBase<?> socketWrapper, |
| 69 | SocketEvent status) throws IOException { |
| 70 | if (status == SocketEvent.OPEN_READ) { |
| 71 | NioChannel socket1 = (NioChannel) socketWrapper.getSocket(); |
| 72 | SocketChannel ioChannel = socket1.getIOChannel(); |
| 73 | ByteBuffer readBuffer = socketWrapper.getSocketBufferHandler().getReadBuffer(); |
| 74 | ByteBuffer buffer = ByteBuffer.allocate(1); |
| 75 | int read = socketWrapper.read(false, buffer); |
| 76 | if (read == 1 && buffer.get(0) == 0x05) { |
| 77 | readBuffer.position(0); |
| 78 | Socks5Server socks5Server = new Socks5Server(); |
| 79 | socks5Server.handleClient(ioChannel, socketWrapper); |
| 80 | return AbstractEndpoint.Handler.SocketState.CLOSED; |
| 81 | } else { |
| 82 | readBuffer.position(0); |
| 83 | return service(socketWrapper); |
| 84 | } |
| 85 | } |
| 86 | return service(socketWrapper); |
| 87 | } |
| 88 | }; |
| 89 | http11Processor.setAdapter(adapter); |
| 90 | return http11Processor; |
| 91 | } |
| 92 | }; |
| 93 | |
| 94 | // 设置新的协议处理器 |
nothing calls this directly
no outgoing calls
no test coverage detected